Algorithmic Trading Model for Exponential Moving Average Crossover Grid Search

Task 1. Prepare Environment

In [1]:
import os
import sys
import numpy as np
import pandas as pd
import requests
import json
import matplotlib.pyplot as plt
from datetime import datetime, timedelta
In [2]:
stock_symbol = 'NFLX'
initial_capital = 0

# Specify the parameters for the trading strategy
fast_ma_min = 5
fast_ma_max = 20
slow_ma_min = 10
slow_ma_max = 50
ma_increment = 5
min_ma_gap = 5

model_start_date = datetime(2019, 1, 1)
print("Starting date for the model:", model_start_date)
stock_start_date = model_start_date - timedelta(days=int(slow_ma_max*1.5)) # Need more pricing data to calculate moving averages

model_end_date = datetime.now()
# model_end_date = datetime(2020, 6, 30)
print("Ending date for the model:", model_end_date)
Starting date for the model: 2019-01-01 00:00:00
Ending date for the model: 2020-07-01 22:53:02.968515
In [3]:
# Begin the timer for the script processing
startTimeScript = datetime.now()

# Set up the verbose flag to print detailed messages for debugging (setting True will activate!)
verbose = True

# Set up the sendNotification flag to send progress emails (setting True will send emails!)
notifyStatus = False

# Set up the parent directory location for loading the dotenv files
useColab = False
if useColab:
    # Mount Google Drive locally for storing files
    from dotenv import load_dotenv
    from google.colab import drive
    drive.mount('/content/gdrive')
    gdrivePrefix = '/content/gdrive/My Drive/Colab_Downloads/'
    env_path = '/content/gdrive/My Drive/Colab Notebooks/'
    dotenv_path = env_path + "python_script.env"
    load_dotenv(dotenv_path=dotenv_path)

# Set up the dotenv file for retrieving environment variables
useLocalPC = False
if useLocalPC:
    from dotenv import load_dotenv
    env_path = "/Users/david/PycharmProjects/"
    dotenv_path = env_path + "python_script.env"
    load_dotenv(dotenv_path=dotenv_path)

# Configure the plotting style
plt.style.use('seaborn')

# Set Pandas options
pd.set_option("display.max_rows", None)
pd.set_option("display.max_columns", None)
# pd.set_option("display.width", 140)

Task 2. Acquire and Pre-Process Data

In [4]:
# Check and see whether the API key is available
quandl_key = os.environ.get('QUANDL_API')
if quandl_key is None: sys.exit("API key for Quandl not available. Script Processing Aborted!!!")
In [5]:
start_date_string = stock_start_date.strftime('%Y-%m-%d')
end_date_string = model_end_date.strftime('%Y-%m-%d')

quandl_url = "https://www.quandl.com/api/v3/datatables/SHARADAR/SEP.json?date.gte=%s&date.lte=%s&ticker=%s&api_key=%s" % (start_date_string, end_date_string, stock_symbol, quandl_key)
In [6]:
response = requests.get(quandl_url)
quandl_dict = json.loads(response.text)
stock_quandl = pd.DataFrame(quandl_dict['datatable']['data'])
print(len(stock_quandl), 'data points retrieved from the API call.')
428 data points retrieved from the API call.
In [7]:
stock_quandl.columns = ['ticker', 'date', 'open', 'high', 'low', 'close', 'volume', 'dividend', 'closeunadj', 'lastupdated']
# stock_quandl.set_index('date', inplace=True)
stock_quandl.index = pd.to_datetime(stock_quandl.date)
stock_quandl = stock_quandl.sort_index(ascending = True)
stock_quandl.info(verbose=True)
<class 'pandas.core.frame.DataFrame'>
DatetimeIndex: 428 entries, 2018-10-18 to 2020-07-01
Data columns (total 10 columns):
 #   Column       Non-Null Count  Dtype  
---  ------       --------------  -----  
 0   ticker       428 non-null    object 
 1   date         428 non-null    object 
 2   open         428 non-null    float64
 3   high         428 non-null    float64
 4   low          428 non-null    float64
 5   close        428 non-null    float64
 6   volume       428 non-null    float64
 7   dividend     428 non-null    float64
 8   closeunadj   428 non-null    float64
 9   lastupdated  428 non-null    object 
dtypes: float64(7), object(3)
memory usage: 36.8+ KB
In [8]:
stock_quandl.head()
Out[8]:
ticker date open high low close volume dividend closeunadj lastupdated
date
2018-10-18 NFLX 2018-10-18 360.673 362.20 346.05 346.71 18461040.0 0.0 346.71 2020-05-01
2018-10-19 NFLX 2018-10-19 351.000 355.80 332.20 332.67 16717233.0 0.0 332.67 2020-05-01
2018-10-22 NFLX 2018-10-22 333.100 335.80 320.34 329.54 17097175.0 0.0 329.54 2020-05-01
2018-10-23 NFLX 2018-10-23 318.000 336.58 316.77 333.16 14907326.0 0.0 333.16 2020-05-01
2018-10-24 NFLX 2018-10-24 332.280 333.00 300.73 301.83 19039297.0 0.0 301.83 2020-05-01
In [9]:
stock_quandl.tail()
Out[9]:
ticker date open high low close volume dividend closeunadj lastupdated
date
2020-06-25 NFLX 2020-06-25 458.86 467.01 454.00 465.91 3938090.0 0.0 465.91 2020-06-25
2020-06-26 NFLX 2020-06-26 466.39 468.03 442.24 443.40 6804726.0 0.0 443.40 2020-06-26
2020-06-29 NFLX 2020-06-29 445.23 447.67 432.14 447.24 4828402.0 0.0 447.24 2020-06-30
2020-06-30 NFLX 2020-06-30 450.02 457.59 447.00 455.04 4167187.0 0.0 455.04 2020-06-30
2020-07-01 NFLX 2020-07-01 454.00 488.23 454.00 485.64 9656467.0 0.0 485.64 2020-07-01
In [10]:
title_string = 'Quandl Historical Stock Information for ' + stock_symbol
stock_quandl['close'].plot(figsize=(16,9), title=title_string)
plt.show()

Task 3. Develop Strategy and Train Model

3.a) Set up the Dataframe for the Trading Model

In [11]:
# Set up the standard column name for modeling
model_template = stock_quandl.loc[:, ['open','close']]
model_template.rename(columns={'open': 'open_price', 'close': 'close_price'}, inplace=True)
if verbose: model_template.info(verbose=True)
<class 'pandas.core.frame.DataFrame'>
DatetimeIndex: 428 entries, 2018-10-18 to 2020-07-01
Data columns (total 2 columns):
 #   Column       Non-Null Count  Dtype  
---  ------       --------------  -----  
 0   open_price   428 non-null    float64
 1   close_price  428 non-null    float64
dtypes: float64(2)
memory usage: 10.0 KB

3.b) Set up the Analysis Table with Indicators

In [12]:
def trading_ma_crossover(model):
    waitfor_first_entry = True
    for x in range(len(model)):
        if model['ma_change'].iloc[x] > 0:
            model['trade_signal'].iloc[x] = 1  # trade_signal = 1 means we should take a long position
        else:
            model['trade_signal'].iloc[x] = 0  # trade_signal = 0 means we should take a flat position
        if x != 0:
            model['signal_change'].iloc[x] = model['trade_signal'].iloc[x] - model['trade_signal'].iloc[x-1]
            if waitfor_first_entry and (model['signal_change'].iloc[x-1] == 1):
                model['entry_exit'].iloc[x] = model['signal_change'].iloc[x-1]
                waitfor_first_entry = False
            elif (not waitfor_first_entry) and (model['signal_change'].iloc[x-1] != 0):
                model['entry_exit'].iloc[x] = model['signal_change'].iloc[x-1]
In [13]:
model_collection = {}
serial_number = 1

for slow_ma in range(slow_ma_min, slow_ma_max+1, ma_increment):
    for fast_ma in range(fast_ma_min, fast_ma_max+1, ma_increment):
        if (slow_ma - fast_ma) < min_ma_gap: break
        print('Processing model with slow_ma of', slow_ma, 'and fast_ma of', fast_ma)
        model_name = 'EMA_' + str(serial_number).zfill(3) + '_SlowMA_' + str(slow_ma).zfill(2) + '_FastMA_' + str(fast_ma).zfill(2)
        serial_number = serial_number + 1
        trading_model = model_template.copy()
        trading_model['fast_ma'] = trading_model['close_price'].ewm(span=fast_ma).mean()
        trading_model['slow_ma'] = trading_model['close_price'].ewm(span=slow_ma).mean()
        trading_model['ma_change'] = trading_model['fast_ma'] - trading_model['slow_ma']
        trading_model['trade_signal'] = np.zeros(len(trading_model))
        trading_model['signal_change'] = np.zeros(len(trading_model))
        trading_model['entry_exit'] = np.zeros(len(trading_model))
        trading_model = trading_model[model_start_date:model_end_date]
        trading_ma_crossover(trading_model)
        model_collection[model_name] = trading_model.copy()
        print('Model', model_name, 'added to the trading model collection.')
Processing model with slow_ma of 10 and fast_ma of 5
Model EMA_001_SlowMA_10_FastMA_05 added to the trading model collection.
Processing model with slow_ma of 15 and fast_ma of 5
Model EMA_002_SlowMA_15_FastMA_05 added to the trading model collection.
Processing model with slow_ma of 15 and fast_ma of 10
Model EMA_003_SlowMA_15_FastMA_10 added to the trading model collection.
Processing model with slow_ma of 20 and fast_ma of 5
Model EMA_004_SlowMA_20_FastMA_05 added to the trading model collection.
Processing model with slow_ma of 20 and fast_ma of 10
Model EMA_005_SlowMA_20_FastMA_10 added to the trading model collection.
Processing model with slow_ma of 20 and fast_ma of 15
Model EMA_006_SlowMA_20_FastMA_15 added to the trading model collection.
Processing model with slow_ma of 25 and fast_ma of 5
Model EMA_007_SlowMA_25_FastMA_05 added to the trading model collection.
Processing model with slow_ma of 25 and fast_ma of 10
Model EMA_008_SlowMA_25_FastMA_10 added to the trading model collection.
Processing model with slow_ma of 25 and fast_ma of 15
Model EMA_009_SlowMA_25_FastMA_15 added to the trading model collection.
Processing model with slow_ma of 25 and fast_ma of 20
Model EMA_010_SlowMA_25_FastMA_20 added to the trading model collection.
Processing model with slow_ma of 30 and fast_ma of 5
Model EMA_011_SlowMA_30_FastMA_05 added to the trading model collection.
Processing model with slow_ma of 30 and fast_ma of 10
Model EMA_012_SlowMA_30_FastMA_10 added to the trading model collection.
Processing model with slow_ma of 30 and fast_ma of 15
Model EMA_013_SlowMA_30_FastMA_15 added to the trading model collection.
Processing model with slow_ma of 30 and fast_ma of 20
Model EMA_014_SlowMA_30_FastMA_20 added to the trading model collection.
Processing model with slow_ma of 35 and fast_ma of 5
Model EMA_015_SlowMA_35_FastMA_05 added to the trading model collection.
Processing model with slow_ma of 35 and fast_ma of 10
Model EMA_016_SlowMA_35_FastMA_10 added to the trading model collection.
Processing model with slow_ma of 35 and fast_ma of 15
Model EMA_017_SlowMA_35_FastMA_15 added to the trading model collection.
Processing model with slow_ma of 35 and fast_ma of 20
Model EMA_018_SlowMA_35_FastMA_20 added to the trading model collection.
Processing model with slow_ma of 40 and fast_ma of 5
Model EMA_019_SlowMA_40_FastMA_05 added to the trading model collection.
Processing model with slow_ma of 40 and fast_ma of 10
Model EMA_020_SlowMA_40_FastMA_10 added to the trading model collection.
Processing model with slow_ma of 40 and fast_ma of 15
Model EMA_021_SlowMA_40_FastMA_15 added to the trading model collection.
Processing model with slow_ma of 40 and fast_ma of 20
Model EMA_022_SlowMA_40_FastMA_20 added to the trading model collection.
Processing model with slow_ma of 45 and fast_ma of 5
Model EMA_023_SlowMA_45_FastMA_05 added to the trading model collection.
Processing model with slow_ma of 45 and fast_ma of 10
Model EMA_024_SlowMA_45_FastMA_10 added to the trading model collection.
Processing model with slow_ma of 45 and fast_ma of 15
Model EMA_025_SlowMA_45_FastMA_15 added to the trading model collection.
Processing model with slow_ma of 45 and fast_ma of 20
Model EMA_026_SlowMA_45_FastMA_20 added to the trading model collection.
Processing model with slow_ma of 50 and fast_ma of 5
Model EMA_027_SlowMA_50_FastMA_05 added to the trading model collection.
Processing model with slow_ma of 50 and fast_ma of 10
Model EMA_028_SlowMA_50_FastMA_10 added to the trading model collection.
Processing model with slow_ma of 50 and fast_ma of 15
Model EMA_029_SlowMA_50_FastMA_15 added to the trading model collection.
Processing model with slow_ma of 50 and fast_ma of 20
Model EMA_030_SlowMA_50_FastMA_20 added to the trading model collection.
In [14]:
# List the entry/exit points for each model
for key in model_collection:
    print('List the signal change and entry/exit points for', key)
    if verbose: print(model_collection[key][(model_collection[key].signal_change != 0) | (model_collection[key].entry_exit != 0)])
    else: print(model_collection[key][model_collection[key].entry_exit != 0])
    print()
List the signal change and entry/exit points for EMA_001_SlowMA_10_FastMA_05
            open_price  close_price     fast_ma     slow_ma  ma_change  \
date                                                                     
2019-03-04     359.720       351.04  356.875358  357.609596  -0.734238   
2019-03-13     355.810       361.21  357.524351  356.964175   0.560176   
2019-03-14     360.500       358.82  357.956234  357.301598   0.654636   
2019-03-27     361.000       353.37  360.648004  361.816467  -1.168463   
2019-03-28     354.485       354.61  358.635336  360.506201  -1.870865   
2019-04-02     366.250       367.72  363.206025  362.297566   0.908460   
2019-04-03     369.260       369.75  365.387350  363.652554   1.734796   
2019-04-12     360.690       351.14  360.672328  362.280410  -1.608082   
2019-04-15     350.710       348.87  356.738219  359.842154  -3.103935   
2019-04-22     359.700       377.34  364.380883  362.440073   1.940810   
2019-04-23     375.450       381.89  370.217255  365.976423   4.240832   
2019-05-08     367.920       364.37  372.104776  372.821425  -0.716648   
2019-05-09     360.900       362.75  368.986518  370.990257  -2.003739   
2019-06-06     354.840       357.13  352.714875  352.158132   0.556744   
2019-06-07     357.390       360.87  355.433250  353.742108   1.691143   
2019-06-12     351.820       345.56  350.709852  351.675880  -0.966028   
2019-06-13     347.230       343.43  348.283235  350.176629  -1.893395   
2019-06-18     355.570       357.12  350.480958  350.233526   0.247433   
2019-06-19     361.720       363.52  354.827306  352.649248   2.178057   
2019-07-15     372.940       366.60  373.585520  373.844934  -0.259414   
2019-07-16     370.090       365.99  371.053680  372.416764  -1.363085   
2019-09-17     294.500       298.60  294.352418  293.427403   0.925015   
2019-09-18     294.990       291.56  293.421612  293.087875   0.333737   
2019-09-19     291.560       286.60  291.147741  291.908262  -0.760520   
2019-09-20     280.260       270.75  284.348494  288.061305  -3.712811   
2019-10-10     265.970       280.48  273.380971  272.266753   1.114217   
2019-10-11     284.800       282.93  276.563980  274.205525   2.358455   
2019-10-22     271.159       266.69  276.313004  277.721714  -1.408710   
2019-10-23     268.060       271.27  274.632003  276.548675  -1.916673   
2019-10-28     278.050       281.86  277.063556  276.940244   0.123313   
2019-10-29     281.870       281.21  278.445704  277.716563   0.729141   
2019-12-05     305.270       302.86  306.383809  306.723736  -0.339928   
2019-12-06     304.700       307.35  306.705872  306.837602  -0.131730   
2019-12-17     307.360       315.48  305.812442  304.371674   1.440768   
2019-12-18     316.260       320.80  310.808295  307.358642   3.449653   
2020-01-22     332.550       326.00  334.131301  334.487170  -0.355869   
2020-01-23     326.040       349.60  339.287534  337.234957   2.052577   
2020-01-24     348.460       353.16  343.911689  340.130419   3.781270   
2020-02-25     372.000       360.09  371.952954  373.603776  -1.650822   
2020-02-26     366.310       379.24  374.381969  374.628544  -0.246575   
2020-03-02     373.110       381.05  375.019472  374.608015   0.411457   
2020-03-03     381.030       368.77  372.936315  373.546558  -0.610243   
2020-03-04     377.770       383.79  376.554210  375.409002   1.145208   
2020-03-05     381.000       372.78  375.296140  374.931002   0.365138   
2020-03-06     367.700       368.97  373.187427  373.847183  -0.659757   
2020-03-09     343.860       346.49  364.288284  368.873150  -4.584865   
2020-03-23     347.890       360.27  338.587961  338.470149   0.117812   
2020-03-24     369.990       357.32  344.831974  341.897395   2.934579   
2020-05-22     437.000       429.32  439.058486  439.462560  -0.404074   
2020-05-26     427.770       414.77  430.962324  434.973004  -4.010679   
2020-06-09     421.650       434.05  424.673134  424.594042   0.079092   
2020-06-10     436.000       434.48  427.942090  426.391489   1.550600   
2020-06-12     429.000       418.07  424.122040  424.754799  -0.632759   
2020-06-15     421.400       425.50  424.581360  424.890290  -0.308930   
2020-06-16     425.760       436.13  428.430907  426.933873   1.497033   
2020-06-17     441.820       447.77  434.877271  430.722260   4.155011   

            trade_signal  signal_change  entry_exit  
date                                                 
2019-03-04           0.0           -1.0         0.0  
2019-03-13           1.0            1.0         0.0  
2019-03-14           1.0            0.0         1.0  
2019-03-27           0.0           -1.0         0.0  
2019-03-28           0.0            0.0        -1.0  
2019-04-02           1.0            1.0         0.0  
2019-04-03           1.0            0.0         1.0  
2019-04-12           0.0           -1.0         0.0  
2019-04-15           0.0            0.0        -1.0  
2019-04-22           1.0            1.0         0.0  
2019-04-23           1.0            0.0         1.0  
2019-05-08           0.0           -1.0         0.0  
2019-05-09           0.0            0.0        -1.0  
2019-06-06           1.0            1.0         0.0  
2019-06-07           1.0            0.0         1.0  
2019-06-12           0.0           -1.0         0.0  
2019-06-13           0.0            0.0        -1.0  
2019-06-18           1.0            1.0         0.0  
2019-06-19           1.0            0.0         1.0  
2019-07-15           0.0           -1.0         0.0  
2019-07-16           0.0            0.0        -1.0  
2019-09-17           1.0            1.0         0.0  
2019-09-18           1.0            0.0         1.0  
2019-09-19           0.0           -1.0         0.0  
2019-09-20           0.0            0.0        -1.0  
2019-10-10           1.0            1.0         0.0  
2019-10-11           1.0            0.0         1.0  
2019-10-22           0.0           -1.0         0.0  
2019-10-23           0.0            0.0        -1.0  
2019-10-28           1.0            1.0         0.0  
2019-10-29           1.0            0.0         1.0  
2019-12-05           0.0           -1.0         0.0  
2019-12-06           0.0            0.0        -1.0  
2019-12-17           1.0            1.0         0.0  
2019-12-18           1.0            0.0         1.0  
2020-01-22           0.0           -1.0         0.0  
2020-01-23           1.0            1.0        -1.0  
2020-01-24           1.0            0.0         1.0  
2020-02-25           0.0           -1.0         0.0  
2020-02-26           0.0            0.0        -1.0  
2020-03-02           1.0            1.0         0.0  
2020-03-03           0.0           -1.0         1.0  
2020-03-04           1.0            1.0        -1.0  
2020-03-05           1.0            0.0         1.0  
2020-03-06           0.0           -1.0         0.0  
2020-03-09           0.0            0.0        -1.0  
2020-03-23           1.0            1.0         0.0  
2020-03-24           1.0            0.0         1.0  
2020-05-22           0.0           -1.0         0.0  
2020-05-26           0.0            0.0        -1.0  
2020-06-09           1.0            1.0         0.0  
2020-06-10           1.0            0.0         1.0  
2020-06-12           0.0           -1.0         0.0  
2020-06-15           0.0            0.0        -1.0  
2020-06-16           1.0            1.0         0.0  
2020-06-17           1.0            0.0         1.0  

List the signal change and entry/exit points for EMA_002_SlowMA_15_FastMA_05
            open_price  close_price     fast_ma     slow_ma  ma_change  \
date                                                                     
2019-01-03     270.200       271.20  264.811004  263.592293   1.218711   
2019-01-04     281.880       297.57  275.730669  267.843095   7.887575   
2019-03-07     360.160       352.60  355.676402  355.822236  -0.145833   
2019-03-08     345.750       349.60  353.650935  355.044454  -1.393519   
2019-03-12     359.370       356.27  355.681527  355.614974   0.066553   
2019-03-13     355.810       361.21  357.524351  356.314353   1.209998   
2019-03-27     361.000       353.37  360.648004  361.283148  -0.635144   
2019-03-28     354.485       354.61  358.635336  360.449004  -1.813668   
2019-04-01     359.000       366.96  360.949038  360.837519   0.111520   
2019-04-02     366.250       367.72  363.206025  361.697829   1.508196   
2019-04-12     360.690       351.14  360.672328  362.458141  -1.785813   
2019-04-15     350.710       348.87  356.738219  360.759623  -4.021404   
2019-04-22     359.700       377.34  364.380883  362.102440   2.278443   
2019-04-23     375.450       381.89  370.217255  364.575885   5.641370   
2019-05-09     360.900       362.75  368.986518  370.686082  -1.699564   
2019-05-10     361.620       361.04  366.337678  369.480321  -3.142643   
2019-06-07     357.390       360.87  355.433250  354.161033   1.272217   
2019-06-10     363.650       352.01  354.292167  353.892154   0.400013   
2019-06-11     355.000       351.27  353.284778  353.564385  -0.279607   
2019-06-12     351.820       345.56  350.709852  352.563837  -1.853985   
2019-06-19     361.720       363.52  354.827306  352.501687   2.325619   
2019-06-20     365.910       365.21  358.288204  354.090226   4.197978   
2019-07-16     370.090       365.99  371.053680  371.325097  -0.271418   
2019-07-17     366.250       362.44  368.182453  370.214460  -2.032007   
2019-09-17     294.500       298.60  294.352418  294.251035   0.101382   
2019-09-18     294.990       291.56  293.421612  293.914656  -0.493044   
2019-09-19     291.560       286.60  291.147741  293.000324  -1.852583   
2019-10-10     265.970       280.48  273.380971  273.343683   0.037287   
2019-10-11     284.800       282.93  276.563980  274.541973   2.022007   
2019-10-22     271.159       266.69  276.313004  277.690617  -1.377613   
2019-10-23     268.060       271.27  274.632003  276.888039  -2.256037   
2019-10-28     278.050       281.86  277.063556  276.986441   0.077116   
2019-10-29     281.870       281.21  278.445704  277.514385   0.931319   
2019-12-10     296.120       293.12  301.242610  303.409584  -2.166974   
2019-12-11     294.490       298.93  300.471740  302.849636  -2.377896   
2019-12-17     307.360       315.48  305.812442  303.791684   2.020759   
2019-12-18     316.260       320.80  310.808295  305.917723   4.890572   
2020-03-09     343.860       346.49  364.288284  369.779593  -5.491309   
2020-03-10     356.425       364.13  364.235523  369.073394  -4.837871   
2020-03-24     369.990       357.32  344.831974  344.400106   0.431868   
2020-03-25     361.020       342.39  344.017983  344.148843  -0.130860   
2020-03-26     344.000       362.99  350.341988  346.503988   3.838001   
2020-03-27     359.090       357.12  352.601326  347.830989   4.770336   
2020-05-26     427.770       414.77  430.962324  433.967021  -3.004697   
2020-05-27     410.380       419.89  427.271550  432.207393  -4.935844   
2020-06-10     436.000       434.48  427.942090  426.629274   1.312815   
2020-06-11     428.200       425.56  427.148060  426.495615   0.652445   
2020-06-12     429.000       418.07  424.122040  425.442413  -1.320373   
2020-06-15     421.400       425.50  424.581360  425.449611  -0.868252   
2020-06-16     425.760       436.13  428.430907  426.784660   1.646247   
2020-06-17     441.820       447.77  434.877271  429.407828   5.469444   

            trade_signal  signal_change  entry_exit  
date                                                 
2019-01-03           1.0            1.0         0.0  
2019-01-04           1.0            0.0         1.0  
2019-03-07           0.0           -1.0         0.0  
2019-03-08           0.0            0.0        -1.0  
2019-03-12           1.0            1.0         0.0  
2019-03-13           1.0            0.0         1.0  
2019-03-27           0.0           -1.0         0.0  
2019-03-28           0.0            0.0        -1.0  
2019-04-01           1.0            1.0         0.0  
2019-04-02           1.0            0.0         1.0  
2019-04-12           0.0           -1.0         0.0  
2019-04-15           0.0            0.0        -1.0  
2019-04-22           1.0            1.0         0.0  
2019-04-23           1.0            0.0         1.0  
2019-05-09           0.0           -1.0         0.0  
2019-05-10           0.0            0.0        -1.0  
2019-06-07           1.0            1.0         0.0  
2019-06-10           1.0            0.0         1.0  
2019-06-11           0.0           -1.0         0.0  
2019-06-12           0.0            0.0        -1.0  
2019-06-19           1.0            1.0         0.0  
2019-06-20           1.0            0.0         1.0  
2019-07-16           0.0           -1.0         0.0  
2019-07-17           0.0            0.0        -1.0  
2019-09-17           1.0            1.0         0.0  
2019-09-18           0.0           -1.0         1.0  
2019-09-19           0.0            0.0        -1.0  
2019-10-10           1.0            1.0         0.0  
2019-10-11           1.0            0.0         1.0  
2019-10-22           0.0           -1.0         0.0  
2019-10-23           0.0            0.0        -1.0  
2019-10-28           1.0            1.0         0.0  
2019-10-29           1.0            0.0         1.0  
2019-12-10           0.0           -1.0         0.0  
2019-12-11           0.0            0.0        -1.0  
2019-12-17           1.0            1.0         0.0  
2019-12-18           1.0            0.0         1.0  
2020-03-09           0.0           -1.0         0.0  
2020-03-10           0.0            0.0        -1.0  
2020-03-24           1.0            1.0         0.0  
2020-03-25           0.0           -1.0         1.0  
2020-03-26           1.0            1.0        -1.0  
2020-03-27           1.0            0.0         1.0  
2020-05-26           0.0           -1.0         0.0  
2020-05-27           0.0            0.0        -1.0  
2020-06-10           1.0            1.0         0.0  
2020-06-11           1.0            0.0         1.0  
2020-06-12           0.0           -1.0         0.0  
2020-06-15           0.0            0.0        -1.0  
2020-06-16           1.0            1.0         0.0  
2020-06-17           1.0            0.0         1.0  

List the signal change and entry/exit points for EMA_003_SlowMA_15_FastMA_10
            open_price  close_price     fast_ma     slow_ma  ma_change  \
date                                                                     
2019-01-04     281.880       297.57  268.997896  267.843095   1.154801   
2019-01-07     302.100       315.34  277.423898  273.784597   3.639302   
2019-03-29     357.160       356.56  359.788710  359.962878  -0.174169   
2019-04-01     359.000       366.96  361.092581  360.837519   0.255062   
2019-04-02     366.250       367.72  362.297566  361.697829   0.599737   
2019-04-12     360.690       351.14  362.280410  362.458141  -0.177730   
2019-04-15     350.710       348.87  359.842154  360.759623  -0.917469   
2019-04-22     359.700       377.34  362.440073  362.102440   0.337633   
2019-04-23     375.450       381.89  365.976423  364.575885   1.400538   
2019-05-10     361.620       361.04  369.181119  369.480321  -0.299202   
2019-05-13     352.290       345.26  364.831825  366.452781  -1.620957   
2019-06-19     361.720       363.52  352.649248  352.501687   0.147561   
2019-06-20     365.910       365.21  354.933021  354.090226   0.842795   
2019-07-18     323.760       325.21  362.349569  364.588903  -2.239333   
2019-07-19     323.400       315.10  353.758739  358.402790  -4.644051   
2019-10-14     283.930       285.53  276.264521  275.915476   0.349044   
2019-10-15     283.820       284.25  277.716426  276.957292   0.759134   
2019-10-23     268.060       271.27  276.548675  276.888039  -0.339364   
2019-10-24     271.810       271.50  275.630734  276.214535  -0.583800   
2019-10-29     281.870       281.21  277.716563  277.514385   0.202177   
2019-10-30     284.340       291.45  280.213551  279.256337   0.957214   
2019-12-11     294.490       298.93  302.831279  302.849636  -0.018357   
2019-12-12     295.670       298.44  302.032864  302.298431  -0.265567   
2019-12-17     307.360       315.48  304.371674  303.791684   0.579991   
2019-12-18     316.260       320.80  307.358642  305.917723   1.440919   
2020-03-09     343.860       346.49  368.873150  369.779593  -0.906443   
2020-03-10     356.425       364.13  368.010759  369.073394  -1.062635   
2020-03-27     359.090       357.12  347.862840  347.830989   0.031851   
2020-03-30     363.000       370.96  352.062324  350.722116   1.340209   
2020-05-28     417.240       413.44  428.814160  429.861469  -1.047310   
2020-05-29     417.460       419.73  427.162494  428.595036  -1.432541   
2020-06-16     425.760       436.13  426.933873  426.784660   0.149213   
2020-06-17     441.820       447.77  430.722260  429.407828   1.314433   

            trade_signal  signal_change  entry_exit  
date                                                 
2019-01-04           1.0            1.0         0.0  
2019-01-07           1.0            0.0         1.0  
2019-03-29           0.0           -1.0         0.0  
2019-04-01           1.0            1.0        -1.0  
2019-04-02           1.0            0.0         1.0  
2019-04-12           0.0           -1.0         0.0  
2019-04-15           0.0            0.0        -1.0  
2019-04-22           1.0            1.0         0.0  
2019-04-23           1.0            0.0         1.0  
2019-05-10           0.0           -1.0         0.0  
2019-05-13           0.0            0.0        -1.0  
2019-06-19           1.0            1.0         0.0  
2019-06-20           1.0            0.0         1.0  
2019-07-18           0.0           -1.0         0.0  
2019-07-19           0.0            0.0        -1.0  
2019-10-14           1.0            1.0         0.0  
2019-10-15           1.0            0.0         1.0  
2019-10-23           0.0           -1.0         0.0  
2019-10-24           0.0            0.0        -1.0  
2019-10-29           1.0            1.0         0.0  
2019-10-30           1.0            0.0         1.0  
2019-12-11           0.0           -1.0         0.0  
2019-12-12           0.0            0.0        -1.0  
2019-12-17           1.0            1.0         0.0  
2019-12-18           1.0            0.0         1.0  
2020-03-09           0.0           -1.0         0.0  
2020-03-10           0.0            0.0        -1.0  
2020-03-27           1.0            1.0         0.0  
2020-03-30           1.0            0.0         1.0  
2020-05-28           0.0           -1.0         0.0  
2020-05-29           0.0            0.0        -1.0  
2020-06-16           1.0            1.0         0.0  
2020-06-17           1.0            0.0         1.0  

List the signal change and entry/exit points for EMA_004_SlowMA_20_FastMA_05
            open_price  close_price     fast_ma     slow_ma  ma_change  \
date                                                                     
2019-01-04     281.880       297.57  275.730669  268.432540   7.298129   
2019-01-07     302.100       315.34  288.933780  272.920094  16.013685   
2019-03-28     354.485       354.61  358.635336  359.645334  -1.009998   
2019-03-29     357.160       356.56  357.943557  359.351488  -1.407931   
2019-04-01     359.000       366.96  360.949038  360.076118   0.872920   
2019-04-02     366.250       367.72  363.206025  360.804116   2.401910   
2019-04-12     360.690       351.14  360.672328  362.093778  -1.421450   
2019-04-15     350.710       348.87  356.738219  360.834364  -4.096146   
2019-04-22     359.700       377.34  364.380883  361.792529   2.588354   
2019-04-23     375.450       381.89  370.217255  363.706579   6.510676   
2019-05-09     360.900       362.75  368.986518  369.887702  -0.901184   
2019-05-10     361.620       361.04  366.337678  369.045063  -2.707384   
2019-06-07     357.390       360.87  355.433250  355.077473   0.355777   
2019-06-10     363.650       352.01  354.292167  354.785333  -0.493166   
2019-06-11     355.000       351.27  353.284778  354.450539  -1.165761   
2019-06-19     361.720       363.52  354.827306  352.990688   1.836618   
2019-06-20     365.910       365.21  358.288204  354.154432   4.133772   
2019-07-17     366.250       362.44  368.182453  369.116203  -0.933750   
2019-07-18     323.760       325.21  353.858302  364.934660 -11.076358   
2019-10-11     284.800       282.93  276.563980  276.048035   0.515946   
2019-10-14     283.930       285.53  279.552654  276.951079   2.601575   
2019-10-22     271.159       266.69  276.313004  278.113331  -1.800327   
2019-10-23     268.060       271.27  274.632003  277.461585  -2.829583   
2019-10-29     281.870       281.21  278.445704  277.727051   0.718653   
2019-10-30     284.340       291.45  282.780469  279.033998   3.746471   
2019-12-10     296.120       293.12  301.242610  302.155312  -0.912702   
2019-12-11     294.490       298.93  300.471740  301.848140  -1.376400   
2019-12-17     307.360       315.48  305.812442  302.848505   2.963938   
2019-12-18     316.260       320.80  310.808295  304.558171   6.250124   
2020-03-09     343.860       346.49  364.288284  368.983998  -4.695714   
2020-03-10     356.425       364.13  364.235523  368.521713  -4.286190   
2020-03-26     344.000       362.99  350.341988  348.145331   2.196658   
2020-03-27     359.090       357.12  352.601326  349.000061   3.601264   
2020-05-26     427.770       414.77  430.962324  431.181487  -0.219162   
2020-05-27     410.380       419.89  427.271550  430.106107  -2.834558   
2020-06-10     436.000       434.48  427.942090  426.384692   1.557397   
2020-06-11     428.200       425.56  427.148060  426.306150   0.841910   
2020-06-12     429.000       418.07  424.122040  425.521755  -1.399715   
2020-06-15     421.400       425.50  424.581360  425.519683  -0.938323   
2020-06-16     425.760       436.13  428.430907  426.530189   1.900717   
2020-06-17     441.820       447.77  434.877271  428.553028   6.324243   

            trade_signal  signal_change  entry_exit  
date                                                 
2019-01-04           1.0            1.0         0.0  
2019-01-07           1.0            0.0         1.0  
2019-03-28           0.0           -1.0         0.0  
2019-03-29           0.0            0.0        -1.0  
2019-04-01           1.0            1.0         0.0  
2019-04-02           1.0            0.0         1.0  
2019-04-12           0.0           -1.0         0.0  
2019-04-15           0.0            0.0        -1.0  
2019-04-22           1.0            1.0         0.0  
2019-04-23           1.0            0.0         1.0  
2019-05-09           0.0           -1.0         0.0  
2019-05-10           0.0            0.0        -1.0  
2019-06-07           1.0            1.0         0.0  
2019-06-10           0.0           -1.0         1.0  
2019-06-11           0.0            0.0        -1.0  
2019-06-19           1.0            1.0         0.0  
2019-06-20           1.0            0.0         1.0  
2019-07-17           0.0           -1.0         0.0  
2019-07-18           0.0            0.0        -1.0  
2019-10-11           1.0            1.0         0.0  
2019-10-14           1.0            0.0         1.0  
2019-10-22           0.0           -1.0         0.0  
2019-10-23           0.0            0.0        -1.0  
2019-10-29           1.0            1.0         0.0  
2019-10-30           1.0            0.0         1.0  
2019-12-10           0.0           -1.0         0.0  
2019-12-11           0.0            0.0        -1.0  
2019-12-17           1.0            1.0         0.0  
2019-12-18           1.0            0.0         1.0  
2020-03-09           0.0           -1.0         0.0  
2020-03-10           0.0            0.0        -1.0  
2020-03-26           1.0            1.0         0.0  
2020-03-27           1.0            0.0         1.0  
2020-05-26           0.0           -1.0         0.0  
2020-05-27           0.0            0.0        -1.0  
2020-06-10           1.0            1.0         0.0  
2020-06-11           1.0            0.0         1.0  
2020-06-12           0.0           -1.0         0.0  
2020-06-15           0.0            0.0        -1.0  
2020-06-16           1.0            1.0         0.0  
2020-06-17           1.0            0.0         1.0  

List the signal change and entry/exit points for EMA_005_SlowMA_20_FastMA_10
            open_price  close_price     fast_ma     slow_ma  ma_change  \
date                                                                     
2019-01-04     281.880       297.57  268.997896  268.432540   0.565355   
2019-01-07     302.100       315.34  277.423898  272.920094   4.503804   
2019-04-15     350.710       348.87  359.842154  360.834364  -0.992211   
2019-04-16     355.000       359.46  359.772671  360.703472  -0.930801   
2019-04-22     359.700       377.34  362.440073  361.792529   0.647545   
2019-04-23     375.450       381.89  365.976423  363.706579   2.269844   
2019-05-13     352.290       345.26  364.831825  366.779817  -1.947992   
2019-05-14     348.710       345.61  361.336947  364.763642  -3.426695   
2019-06-20     365.910       365.21  354.933021  354.154432   0.778590   
2019-06-21     365.000       369.21  357.528836  355.588295   1.940540   
2019-07-18     323.760       325.21  362.349569  364.934660  -2.585090   
2019-07-19     323.400       315.10  353.758739  360.188502  -6.429763   
2019-10-15     283.820       284.25  277.716426  277.646214   0.070212   
2019-10-16     283.120       286.28  279.273440  278.468480   0.804960   
2019-10-22     271.159       266.69  277.721714  278.113331  -0.391617   
2019-10-23     268.060       271.27  276.548675  277.461585  -0.912910   
2019-10-30     284.340       291.45  280.213551  279.033998   1.179553   
2019-10-31     291.000       287.41  281.521997  279.831713   1.690284   
2020-03-09     343.860       346.49  368.873150  368.983998  -0.110848   
2020-03-10     356.425       364.13  368.010759  368.521713  -0.510954   
2020-03-30     363.000       370.96  352.062324  351.091484   0.970840   
2020-03-31     367.930       375.50  356.323720  353.416104   2.907615   
2020-05-29     417.460       419.73  427.162494  427.681825  -0.519330   
2020-06-01     418.830       425.92  426.936586  427.514032  -0.577446   
2020-06-10     436.000       434.48  426.391489  426.384692   0.006797   
2020-06-11     428.200       425.56  426.240309  426.306150  -0.065841   
2020-06-12     429.000       418.07  424.754799  425.521755  -0.766956   
2020-06-16     425.760       436.13  426.933873  426.530189   0.403684   
2020-06-17     441.820       447.77  430.722260  428.553028   2.169232   

            trade_signal  signal_change  entry_exit  
date                                                 
2019-01-04           1.0            1.0         0.0  
2019-01-07           1.0            0.0         1.0  
2019-04-15           0.0           -1.0         0.0  
2019-04-16           0.0            0.0        -1.0  
2019-04-22           1.0            1.0         0.0  
2019-04-23           1.0            0.0         1.0  
2019-05-13           0.0           -1.0         0.0  
2019-05-14           0.0            0.0        -1.0  
2019-06-20           1.0            1.0         0.0  
2019-06-21           1.0            0.0         1.0  
2019-07-18           0.0           -1.0         0.0  
2019-07-19           0.0            0.0        -1.0  
2019-10-15           1.0            1.0         0.0  
2019-10-16           1.0            0.0         1.0  
2019-10-22           0.0           -1.0         0.0  
2019-10-23           0.0            0.0        -1.0  
2019-10-30           1.0            1.0         0.0  
2019-10-31           1.0            0.0         1.0  
2020-03-09           0.0           -1.0         0.0  
2020-03-10           0.0            0.0        -1.0  
2020-03-30           1.0            1.0         0.0  
2020-03-31           1.0            0.0         1.0  
2020-05-29           0.0           -1.0         0.0  
2020-06-01           0.0            0.0        -1.0  
2020-06-10           1.0            1.0         0.0  
2020-06-11           0.0           -1.0         1.0  
2020-06-12           0.0            0.0        -1.0  
2020-06-16           1.0            1.0         0.0  
2020-06-17           1.0            0.0         1.0  

List the signal change and entry/exit points for EMA_006_SlowMA_20_FastMA_15
            open_price  close_price     fast_ma     slow_ma  ma_change  \
date                                                                     
2019-01-07      302.10       315.34  273.784597  272.920094   0.864502   
2019-01-08      319.98       320.27  279.599030  277.448029   2.151001   
2019-04-15      350.71       348.87  360.759623  360.834364  -0.074742   
2019-04-16      355.00       359.46  360.597170  360.703472  -0.106302   
2019-04-22      359.70       377.34  362.102440  361.792529   0.309911   
2019-04-23      375.45       381.89  364.575885  363.706579   0.869306   
2019-05-13      352.29       345.26  366.452781  366.779817  -0.327036   
2019-05-14      348.71       345.61  363.847434  364.763642  -0.916209   
2019-06-21      365.00       369.21  355.980198  355.588295   0.391902   
2019-06-24      370.27       371.04  357.862673  357.059886   0.802787   
2019-07-18      323.76       325.21  364.588903  364.934660  -0.345757   
2019-07-19      323.40       315.10  358.402790  360.188502  -1.785712   
2019-10-17      304.49       293.35  280.026052  279.885767   0.140284   
2019-10-18      289.36       275.30  279.435295  279.449028  -0.013733   
2019-10-21      272.89       278.05  279.262133  279.315787  -0.053654   
2019-10-30      284.34       291.45  279.256337  279.033998   0.222339   
2019-10-31      291.00       287.41  280.275545  279.831713   0.443832   
2020-03-11      358.92       349.92  366.679220  366.750121  -0.070901   
2020-03-12      326.50       315.25  360.250567  361.845347  -1.594780   
2020-03-31      367.93       375.50  353.819351  353.416104   0.403247   
2020-04-01      376.05       364.08  355.101932  354.431714   0.670219   
2020-06-04      422.39       414.33  425.740303  425.764786  -0.024483   
2020-06-05      407.29       419.60  424.972765  425.177664  -0.204899   
2020-06-10      436.00       434.48  426.629274  426.384692   0.244582   
2020-06-11      428.20       425.56  426.495615  426.306150   0.189465   
2020-06-12      429.00       418.07  425.442413  425.521755  -0.079342   
2020-06-15      421.40       425.50  425.449611  425.519683  -0.070072   
2020-06-16      425.76       436.13  426.784660  426.530189   0.254471   
2020-06-17      441.82       447.77  429.407828  428.553028   0.854799   

            trade_signal  signal_change  entry_exit  
date                                                 
2019-01-07           1.0            1.0         0.0  
2019-01-08           1.0            0.0         1.0  
2019-04-15           0.0           -1.0         0.0  
2019-04-16           0.0            0.0        -1.0  
2019-04-22           1.0            1.0         0.0  
2019-04-23           1.0            0.0         1.0  
2019-05-13           0.0           -1.0         0.0  
2019-05-14           0.0            0.0        -1.0  
2019-06-21           1.0            1.0         0.0  
2019-06-24           1.0            0.0         1.0  
2019-07-18           0.0           -1.0         0.0  
2019-07-19           0.0            0.0        -1.0  
2019-10-17           1.0            1.0         0.0  
2019-10-18           0.0           -1.0         1.0  
2019-10-21           0.0            0.0        -1.0  
2019-10-30           1.0            1.0         0.0  
2019-10-31           1.0            0.0         1.0  
2020-03-11           0.0           -1.0         0.0  
2020-03-12           0.0            0.0        -1.0  
2020-03-31           1.0            1.0         0.0  
2020-04-01           1.0            0.0         1.0  
2020-06-04           0.0           -1.0         0.0  
2020-06-05           0.0            0.0        -1.0  
2020-06-10           1.0            1.0         0.0  
2020-06-11           1.0            0.0         1.0  
2020-06-12           0.0           -1.0         0.0  
2020-06-15           0.0            0.0        -1.0  
2020-06-16           1.0            1.0         0.0  
2020-06-17           1.0            0.0         1.0  

List the signal change and entry/exit points for EMA_007_SlowMA_25_FastMA_05
            open_price  close_price     fast_ma     slow_ma  ma_change  \
date                                                                     
2019-01-04     281.880       297.57  275.730669  269.577824   6.152845   
2019-01-07     302.100       315.34  288.933780  273.145330  15.788450   
2019-03-29     357.160       356.56  357.943557  358.173955  -0.230398   
2019-04-01     359.000       366.96  360.949038  358.849891   2.099147   
2019-04-02     366.250       367.72  363.206025  359.532288   3.673737   
2019-04-12     360.690       351.14  360.672328  361.322156  -0.649828   
2019-04-15     350.710       348.87  356.738219  360.364242  -3.626024   
2019-04-22     359.700       377.34  364.380883  361.245752   3.135131   
2019-04-23     375.450       381.89  370.217255  362.833832   7.383423   
2019-05-10     361.620       361.04  366.337678  368.329729  -1.992051   
2019-05-13     352.290       345.26  359.311786  366.555112  -7.243327   
2019-06-19     361.720       363.52  354.827306  353.663931   1.163375   
2019-06-20     365.910       365.21  358.288204  354.552091   3.736113   
2019-07-18     323.760       325.21  353.858302  364.708289 -10.849987   
2019-07-19     323.400       315.10  340.938868  360.892266 -19.953398   
2019-10-14     283.930       285.53  279.552654  278.697875   0.854778   
2019-10-15     283.820       284.25  281.118436  279.124962   1.993474   
2019-10-22     271.159       266.69  276.313004  279.101634  -2.788630   
2019-10-23     268.060       271.27  274.632003  278.499201  -3.867198   
2019-10-29     281.870       281.21  278.445704  278.412833   0.032871   
2019-10-30     284.340       291.45  282.780469  279.415692   3.364778   
2019-12-11     294.490       298.93  300.471740  300.561998  -0.090258   
2019-12-12     295.670       298.44  299.794493  300.398767  -0.604274   
2019-12-16     300.850       304.21  300.978664  300.557115   0.421548   
2019-12-17     307.360       315.48  305.812442  301.705030   4.107413   
2020-03-09     343.860       346.49  364.288284  367.301480  -3.013195   
2020-03-10     356.425       364.13  364.235523  367.057520  -2.821997   
2020-03-26     344.000       362.99  350.341988  349.440172   0.901816   
2020-03-27     359.090       357.12  352.601326  350.030928   2.570398   
2020-05-28     417.240       413.44  422.661033  426.021552  -3.360519   
2020-05-29     417.460       419.73  421.684022  425.537587  -3.853565   
2020-06-09     421.650       434.05  424.673134  424.606045   0.067090   
2020-06-10     436.000       434.48  427.942090  425.365580   2.576510   
2020-06-12     429.000       418.07  424.122040  424.818186  -0.696146   
2020-06-15     421.400       425.50  424.581360  424.870633  -0.289274   
2020-06-16     425.760       436.13  428.430907  425.736739   2.694168   
2020-06-17     441.820       447.77  434.877271  427.431605   7.445666   

            trade_signal  signal_change  entry_exit  
date                                                 
2019-01-04           1.0            1.0         0.0  
2019-01-07           1.0            0.0         1.0  
2019-03-29           0.0           -1.0         0.0  
2019-04-01           1.0            1.0        -1.0  
2019-04-02           1.0            0.0         1.0  
2019-04-12           0.0           -1.0         0.0  
2019-04-15           0.0            0.0        -1.0  
2019-04-22           1.0            1.0         0.0  
2019-04-23           1.0            0.0         1.0  
2019-05-10           0.0           -1.0         0.0  
2019-05-13           0.0            0.0        -1.0  
2019-06-19           1.0            1.0         0.0  
2019-06-20           1.0            0.0         1.0  
2019-07-18           0.0           -1.0         0.0  
2019-07-19           0.0            0.0        -1.0  
2019-10-14           1.0            1.0         0.0  
2019-10-15           1.0            0.0         1.0  
2019-10-22           0.0           -1.0         0.0  
2019-10-23           0.0            0.0        -1.0  
2019-10-29           1.0            1.0         0.0  
2019-10-30           1.0            0.0         1.0  
2019-12-11           0.0           -1.0         0.0  
2019-12-12           0.0            0.0        -1.0  
2019-12-16           1.0            1.0         0.0  
2019-12-17           1.0            0.0         1.0  
2020-03-09           0.0           -1.0         0.0  
2020-03-10           0.0            0.0        -1.0  
2020-03-26           1.0            1.0         0.0  
2020-03-27           1.0            0.0         1.0  
2020-05-28           0.0           -1.0         0.0  
2020-05-29           0.0            0.0        -1.0  
2020-06-09           1.0            1.0         0.0  
2020-06-10           1.0            0.0         1.0  
2020-06-12           0.0           -1.0         0.0  
2020-06-15           0.0            0.0        -1.0  
2020-06-16           1.0            1.0         0.0  
2020-06-17           1.0            0.0         1.0  

List the signal change and entry/exit points for EMA_008_SlowMA_25_FastMA_10
            open_price  close_price     fast_ma     slow_ma  ma_change  \
date                                                                     
2019-01-07     302.100       315.34  277.423898  273.145330   4.278569   
2019-01-08     319.980       320.27  285.214224  276.815255   8.398969   
2019-04-15     350.710       348.87  359.842154  360.364242  -0.522089   
2019-04-16     355.000       359.46  359.772671  360.294682  -0.522010   
2019-04-22     359.700       377.34  362.440073  361.245752   1.194321   
2019-04-23     375.450       381.89  365.976423  362.833832   3.142591   
2019-05-13     352.290       345.26  364.831825  366.555112  -1.723288   
2019-05-14     348.710       345.61  361.336947  364.943931  -3.606984   
2019-06-20     365.910       365.21  354.933021  354.552091   0.380930   
2019-06-21     365.000       369.21  357.528836  355.679624   1.849212   
2019-07-18     323.760       325.21  362.349569  364.708289  -2.358720   
2019-07-19     323.400       315.10  353.758739  360.892266  -7.133527   
2019-10-17     304.490       293.35  281.832814  280.727246   1.105568   
2019-10-18     289.360       275.30  280.645030  280.309765   0.335265   
2019-10-22     271.159       266.69  277.721714  279.101634  -1.379920   
2019-10-23     268.060       271.27  276.548675  278.499201  -1.950526   
2019-10-30     284.340       291.45  280.213551  279.415692   0.797860   
2019-10-31     291.000       287.41  281.521997  280.030639   1.491358   
2020-03-11     358.920       349.92  364.721530  365.739249  -1.017719   
2020-03-12     326.500       315.25  355.726706  361.855461  -6.128754   
2020-03-30     363.000       370.96  352.062324  351.640857   0.421467   
2020-03-31     367.930       375.50  356.323720  353.476175   2.847544   
2020-06-04     422.390       414.33  423.951098  424.561453  -0.610355   
2020-06-05     407.290       419.60  423.159989  424.179802  -1.019813   
2020-06-10     436.000       434.48  426.391489  425.365580   1.025910   
2020-06-11     428.200       425.56  426.240309  425.380535   0.859774   
2020-06-12     429.000       418.07  424.754799  424.818186  -0.063388   
2020-06-15     421.400       425.50  424.890290  424.870633   0.019656   
2020-06-16     425.760       436.13  426.933873  425.736739   1.197135   

            trade_signal  signal_change  entry_exit  
date                                                 
2019-01-07           1.0            1.0         0.0  
2019-01-08           1.0            0.0         1.0  
2019-04-15           0.0           -1.0         0.0  
2019-04-16           0.0            0.0        -1.0  
2019-04-22           1.0            1.0         0.0  
2019-04-23           1.0            0.0         1.0  
2019-05-13           0.0           -1.0         0.0  
2019-05-14           0.0            0.0        -1.0  
2019-06-20           1.0            1.0         0.0  
2019-06-21           1.0            0.0         1.0  
2019-07-18           0.0           -1.0         0.0  
2019-07-19           0.0            0.0        -1.0  
2019-10-17           1.0            1.0         0.0  
2019-10-18           1.0            0.0         1.0  
2019-10-22           0.0           -1.0         0.0  
2019-10-23           0.0            0.0        -1.0  
2019-10-30           1.0            1.0         0.0  
2019-10-31           1.0            0.0         1.0  
2020-03-11           0.0           -1.0         0.0  
2020-03-12           0.0            0.0        -1.0  
2020-03-30           1.0            1.0         0.0  
2020-03-31           1.0            0.0         1.0  
2020-06-04           0.0           -1.0         0.0  
2020-06-05           0.0            0.0        -1.0  
2020-06-10           1.0            1.0         0.0  
2020-06-11           1.0            0.0         1.0  
2020-06-12           0.0           -1.0         0.0  
2020-06-15           1.0            1.0        -1.0  
2020-06-16           1.0            0.0         1.0  

List the signal change and entry/exit points for EMA_009_SlowMA_25_FastMA_15
            open_price  close_price     fast_ma     slow_ma  ma_change  \
date                                                                     
2019-01-07      302.10      315.340  273.784597  273.145330   0.639267   
2019-01-08      319.98      320.270  279.599030  276.815255   2.783774   
2019-04-17      365.05      354.740  359.865024  359.867378  -0.002354   
2019-04-18      355.00      360.350  359.925646  359.904504   0.021142   
2019-04-22      359.70      377.340  362.102440  361.245752   0.856688   
2019-05-13      352.29      345.260  366.452781  366.555112  -0.102331   
2019-05-14      348.71      345.610  363.847434  364.943931  -1.096498   
2019-06-21      365.00      369.210  355.980198  355.679624   0.300574   
2019-06-24      370.27      371.040  357.862673  356.861193   1.001480   
2019-07-18      323.76      325.210  364.588903  364.708289  -0.119387   
2019-07-19      323.40      315.100  358.402790  360.892266  -2.489476   
2019-10-31      291.00      287.410  280.275545  280.030639   0.244906   
2019-11-01      288.70      286.810  281.092352  280.552128   0.540224   
2020-03-12      326.50      315.250  360.250567  361.855461  -1.604893   
2020-03-13      330.51      336.295  357.256121  359.889271  -2.633150   
2020-03-31      367.93      375.500  353.819351  353.476175   0.343176   
2020-04-01      376.05      364.080  355.101932  354.291854   0.810078   

            trade_signal  signal_change  entry_exit  
date                                                 
2019-01-07           1.0            1.0         0.0  
2019-01-08           1.0            0.0         1.0  
2019-04-17           0.0           -1.0         0.0  
2019-04-18           1.0            1.0        -1.0  
2019-04-22           1.0            0.0         1.0  
2019-05-13           0.0           -1.0         0.0  
2019-05-14           0.0            0.0        -1.0  
2019-06-21           1.0            1.0         0.0  
2019-06-24           1.0            0.0         1.0  
2019-07-18           0.0           -1.0         0.0  
2019-07-19           0.0            0.0        -1.0  
2019-10-31           1.0            1.0         0.0  
2019-11-01           1.0            0.0         1.0  
2020-03-12           0.0           -1.0         0.0  
2020-03-13           0.0            0.0        -1.0  
2020-03-31           1.0            1.0         0.0  
2020-04-01           1.0            0.0         1.0  

List the signal change and entry/exit points for EMA_010_SlowMA_25_FastMA_20
            open_price  close_price     fast_ma     slow_ma  ma_change  \
date                                                                     
2019-01-08      319.98      320.270  277.448029  276.815255   0.632774   
2019-01-09      317.71      319.960  281.511745  280.172035   1.339710   
2019-05-14      348.71      345.610  364.763642  364.943931  -0.180289   
2019-05-15      343.34      354.990  363.832819  364.178236  -0.345417   
2019-06-24      370.27      371.040  357.059886  356.861193   0.198693   
2019-06-25      370.75      360.300  357.368469  357.125717   0.242752   
2019-07-19      323.40      315.100  360.188502  360.892266  -0.703764   
2019-07-22      312.00      310.620  355.467692  357.025168  -1.557476   
2019-11-04      288.00      292.860  281.673806  281.498887   0.174918   
2019-11-05      289.99      288.030  282.279158  282.001281   0.277877   
2020-03-12      326.50      315.250  361.845347  361.855461  -0.010113   
2020-03-13      330.51      336.295  359.411981  359.889271  -0.477290   
2020-04-01      376.05      364.080  354.431714  354.291854   0.139859   
2020-04-02      364.08      370.080  355.922027  355.506327   0.415700   

            trade_signal  signal_change  entry_exit  
date                                                 
2019-01-08           1.0            1.0         0.0  
2019-01-09           1.0            0.0         1.0  
2019-05-14           0.0           -1.0         0.0  
2019-05-15           0.0            0.0        -1.0  
2019-06-24           1.0            1.0         0.0  
2019-06-25           1.0            0.0         1.0  
2019-07-19           0.0           -1.0         0.0  
2019-07-22           0.0            0.0        -1.0  
2019-11-04           1.0            1.0         0.0  
2019-11-05           1.0            0.0         1.0  
2020-03-12           0.0           -1.0         0.0  
2020-03-13           0.0            0.0        -1.0  
2020-04-01           1.0            1.0         0.0  
2020-04-02           1.0            0.0         1.0  

List the signal change and entry/exit points for EMA_011_SlowMA_30_FastMA_05
            open_price  close_price     fast_ma     slow_ma  ma_change  \
date                                                                     
2019-01-04     281.880       297.57  275.730669  270.828146   4.902523   
2019-01-07     302.100       315.34  288.933780  273.780439  15.153341   
2019-04-15     350.710       348.87  356.738219  359.476217  -2.737999   
2019-04-16     355.000       359.46  357.645479  359.475171  -1.829692   
2019-04-22     359.700       377.34  364.380883  360.413402   3.967480   
2019-04-23     375.450       381.89  370.217255  361.799280   8.417975   
2019-05-10     361.620       361.04  366.337678  367.433126  -1.095447   
2019-05-13     352.290       345.26  359.311786  366.002483  -6.690698   
2019-06-19     361.720       363.52  354.827306  354.310073   0.517232   
2019-06-20     365.910       365.21  358.288204  355.013304   3.274900   
2019-07-18     323.760       325.21  353.858302  364.334250 -10.475948   
2019-07-19     323.400       315.10  340.938868  361.157835 -20.218967   
2019-10-15     283.820       284.25  281.118436  281.062833   0.055603   
2019-10-16     283.120       286.28  282.838957  281.399425   1.439533   
2019-10-21     272.890       278.05  281.124506  281.489939  -0.365433   
2019-10-22     271.159       266.69  276.313004  280.535104  -4.222100   
2019-10-30     284.340       291.45  282.780469  280.283929   2.496541   
2019-10-31     291.000       287.41  284.323646  280.743675   3.579971   
2020-03-09     343.860       346.49  364.288284  365.160028  -0.871743   
2020-03-10     356.425       364.13  364.235523  365.093574  -0.858051   
2020-03-26     344.000       362.99  350.341988  350.144465   0.197524   
2020-03-27     359.090       357.12  352.601326  350.594499   2.006826   
2020-05-28     417.240       413.44  422.661033  423.009849  -0.348816   
2020-05-29     417.460       419.73  421.684022  422.798246  -1.114224   
2020-06-01     418.830       425.92  423.096015  422.999649   0.096365   
2020-06-02     425.870       427.31  424.500676  423.277736   1.222940   
2020-06-04     422.390       414.33  420.548078  422.621536  -2.073458   
2020-06-05     407.290       419.60  420.232052  422.426598  -2.194546   
2020-06-09     421.650       434.05  424.673134  422.999260   1.673874   
2020-06-10     436.000       434.48  427.942090  423.739953   4.202136   

            trade_signal  signal_change  entry_exit  
date                                                 
2019-01-04           1.0            1.0         0.0  
2019-01-07           1.0            0.0         1.0  
2019-04-15           0.0           -1.0         0.0  
2019-04-16           0.0            0.0        -1.0  
2019-04-22           1.0            1.0         0.0  
2019-04-23           1.0            0.0         1.0  
2019-05-10           0.0           -1.0         0.0  
2019-05-13           0.0            0.0        -1.0  
2019-06-19           1.0            1.0         0.0  
2019-06-20           1.0            0.0         1.0  
2019-07-18           0.0           -1.0         0.0  
2019-07-19           0.0            0.0        -1.0  
2019-10-15           1.0            1.0         0.0  
2019-10-16           1.0            0.0         1.0  
2019-10-21           0.0           -1.0         0.0  
2019-10-22           0.0            0.0        -1.0  
2019-10-30           1.0            1.0         0.0  
2019-10-31           1.0            0.0         1.0  
2020-03-09           0.0           -1.0         0.0  
2020-03-10           0.0            0.0        -1.0  
2020-03-26           1.0            1.0         0.0  
2020-03-27           1.0            0.0         1.0  
2020-05-28           0.0           -1.0         0.0  
2020-05-29           0.0            0.0        -1.0  
2020-06-01           1.0            1.0         0.0  
2020-06-02           1.0            0.0         1.0  
2020-06-04           0.0           -1.0         0.0  
2020-06-05           0.0            0.0        -1.0  
2020-06-09           1.0            1.0         0.0  
2020-06-10           1.0            0.0         1.0  

List the signal change and entry/exit points for EMA_012_SlowMA_30_FastMA_10
            open_price  close_price     fast_ma     slow_ma  ma_change  \
date                                                                     
2019-01-07      302.10      315.340  277.423898  273.780439   3.643460   
2019-01-08      319.98      320.270  285.214224  276.858334   8.355890   
2019-04-17      365.05      354.740  358.857640  359.169598  -0.311958   
2019-04-18      355.00      360.350  359.128978  359.245771  -0.116793   
2019-04-22      359.70      377.340  362.440073  360.413402   2.026671   
2019-04-23      375.45      381.890  365.976423  361.799280   4.177144   
2019-05-13      352.29      345.260  364.831825  366.002483  -1.170659   
2019-05-14      348.71      345.610  361.336947  364.686738  -3.349790   
2019-06-21      365.00      369.210  357.528836  355.929232   1.599604   
2019-06-24      370.27      371.040  359.985411  356.904132   3.081279   
2019-07-18      323.76      325.210  362.349569  364.334250  -1.984680   
2019-07-19      323.40      315.100  353.758739  361.157835  -7.399097   
2019-10-31      291.00      287.410  281.521997  280.743675   0.778321   
2019-11-01      288.70      286.810  282.483452  281.135051   1.348401   
2020-03-12      326.50      315.250  355.726706  360.962077  -5.235370   
2020-03-13      330.51      336.295  352.193669  359.370653  -7.176984   
2020-03-30      363.00      370.960  352.062324  351.908403   0.153921   
2020-03-31      367.93      375.500  356.323720  353.430441   2.893278   

            trade_signal  signal_change  entry_exit  
date                                                 
2019-01-07           1.0            1.0         0.0  
2019-01-08           1.0            0.0         1.0  
2019-04-17           0.0           -1.0         0.0  
2019-04-18           0.0            0.0        -1.0  
2019-04-22           1.0            1.0         0.0  
2019-04-23           1.0            0.0         1.0  
2019-05-13           0.0           -1.0         0.0  
2019-05-14           0.0            0.0        -1.0  
2019-06-21           1.0            1.0         0.0  
2019-06-24           1.0            0.0         1.0  
2019-07-18           0.0           -1.0         0.0  
2019-07-19           0.0            0.0        -1.0  
2019-10-31           1.0            1.0         0.0  
2019-11-01           1.0            0.0         1.0  
2020-03-12           0.0           -1.0         0.0  
2020-03-13           0.0            0.0        -1.0  
2020-03-30           1.0            1.0         0.0  
2020-03-31           1.0            0.0         1.0  

List the signal change and entry/exit points for EMA_013_SlowMA_30_FastMA_15
            open_price  close_price     fast_ma     slow_ma  ma_change  \
date                                                                     
2019-01-07      302.10      315.340  273.784597  273.780439   0.004158   
2019-01-08      319.98      320.270  279.599030  276.858334   2.740696   
2019-05-14      348.71      345.610  363.847434  364.686738  -0.839304   
2019-05-15      343.34      354.990  362.740254  364.061097  -1.320842   
2019-06-21      365.00      369.210  355.980198  355.929232   0.050966   
2019-06-24      370.27      371.040  357.862673  356.904132   0.958541   
2019-07-19      323.40      315.100  358.402790  361.157835  -2.755045   
2019-07-22      312.00      310.620  352.429941  357.897319  -5.467378   
2019-11-04      288.00      292.860  282.563308  281.891500   0.671808   
2019-11-05      289.99      288.030  283.246644  282.287532   0.959113   
2020-03-12      326.50      315.250  360.250567  360.962077  -0.711509   
2020-03-13      330.51      336.295  357.256121  359.370653  -2.114531   
2020-03-31      367.93      375.500  353.819351  353.430441   0.388910   
2020-04-01      376.05      364.080  355.101932  354.117510   0.984423   

            trade_signal  signal_change  entry_exit  
date                                                 
2019-01-07           1.0            1.0         0.0  
2019-01-08           1.0            0.0         1.0  
2019-05-14           0.0           -1.0         0.0  
2019-05-15           0.0            0.0        -1.0  
2019-06-21           1.0            1.0         0.0  
2019-06-24           1.0            0.0         1.0  
2019-07-19           0.0           -1.0         0.0  
2019-07-22           0.0            0.0        -1.0  
2019-11-04           1.0            1.0         0.0  
2019-11-05           1.0            0.0         1.0  
2020-03-12           0.0           -1.0         0.0  
2020-03-13           0.0            0.0        -1.0  
2020-03-31           1.0            1.0         0.0  
2020-04-01           1.0            0.0         1.0  

List the signal change and entry/exit points for EMA_014_SlowMA_30_FastMA_20
            open_price  close_price     fast_ma     slow_ma  ma_change  \
date                                                                     
2019-01-08      319.98       320.27  277.448029  276.858334   0.589695   
2019-01-09      317.71       319.96  281.511745  279.707116   1.804630   
2019-05-15      343.34       354.99  363.832819  364.061097  -0.228278   
2019-05-16      356.37       359.31  363.402074  363.754554  -0.352480   
2019-06-24      370.27       371.04  357.059886  356.904132   0.155755   
2019-06-25      370.75       360.30  357.368469  357.123222   0.245246   
2019-07-19      323.40       315.10  360.188502  361.157835  -0.969334   
2019-07-22      312.00       310.62  355.467692  357.897319  -2.429627   
2019-11-06      288.19       288.59  282.880190  282.694143   0.186047   
2019-11-07      290.70       289.57  283.517315  283.137746   0.379569   
2020-03-16      306.63       298.84  353.643221  355.465449  -1.822228   
2020-03-17      306.18       319.75  350.415295  353.161227  -2.745932   
2020-04-01      376.05       364.08  354.431714  354.117510   0.314204   
2020-04-02      364.08       370.08  355.922027  355.147348   0.774679   

            trade_signal  signal_change  entry_exit  
date                                                 
2019-01-08           1.0            1.0         0.0  
2019-01-09           1.0            0.0         1.0  
2019-05-15           0.0           -1.0         0.0  
2019-05-16           0.0            0.0        -1.0  
2019-06-24           1.0            1.0         0.0  
2019-06-25           1.0            0.0         1.0  
2019-07-19           0.0           -1.0         0.0  
2019-07-22           0.0            0.0        -1.0  
2019-11-06           1.0            1.0         0.0  
2019-11-07           1.0            0.0         1.0  
2020-03-16           0.0           -1.0         0.0  
2020-03-17           0.0            0.0        -1.0  
2020-04-01           1.0            1.0         0.0  
2020-04-02           1.0            0.0         1.0  

List the signal change and entry/exit points for EMA_015_SlowMA_35_FastMA_05
            open_price  close_price     fast_ma     slow_ma  ma_change  \
date                                                                     
2019-01-04      281.88       297.57  275.730669  272.014659   3.716010   
2019-01-07      302.10       315.34  288.933780  274.536780  14.396999   
2019-04-15      350.71       348.87  356.738219  358.284784  -1.546566   
2019-04-16      355.00       359.46  357.645479  358.350132  -0.704653   
2019-04-22      359.70       377.34  364.380883  359.331890   5.048993   
2019-04-23      375.45       381.89  370.217255  360.586001   9.631254   
2019-05-10      361.62       361.04  366.337678  366.385168  -0.047489   
2019-05-13      352.29       345.26  359.311786  365.211176  -5.899390   
2019-06-20      365.91       365.21  358.288204  355.406554   2.881649   
2019-06-21      365.00       369.21  361.928802  356.173461   5.755341   
2019-07-18      323.76       325.21  353.858302  363.935179 -10.076877   
2019-07-19      323.40       315.10  340.938868  361.222055 -20.283187   
2019-10-17      304.49       293.35  286.342638  283.980897   2.361741   
2019-10-18      289.36       275.30  282.661759  283.498625  -0.836866   
2019-10-21      272.89       278.05  281.124506  283.195924  -2.071418   
2019-10-30      284.34       291.45  282.780469  281.520088   1.260382   
2019-10-31      291.00       287.41  284.323646  281.847305   2.476341   
2020-03-11      358.92       349.92  359.463682  362.153190  -2.689508   
2020-03-12      326.50       315.25  344.725788  359.547458 -14.821670   
2020-03-26      344.00       362.99  350.341988  350.305318   0.036670   
2020-03-27      359.09       357.12  352.601326  350.683911   1.917414   
2020-06-05      407.29       419.60  420.232052  420.236892  -0.004839   
2020-06-08      416.00       419.49  419.984702  420.195398  -0.210696   
2020-06-09      421.65       434.05  424.673134  420.965098   3.708037   
2020-06-10      436.00       434.48  427.942090  421.715926   6.226164   

            trade_signal  signal_change  entry_exit  
date                                                 
2019-01-04           1.0            1.0         0.0  
2019-01-07           1.0            0.0         1.0  
2019-04-15           0.0           -1.0         0.0  
2019-04-16           0.0            0.0        -1.0  
2019-04-22           1.0            1.0         0.0  
2019-04-23           1.0            0.0         1.0  
2019-05-10           0.0           -1.0         0.0  
2019-05-13           0.0            0.0        -1.0  
2019-06-20           1.0            1.0         0.0  
2019-06-21           1.0            0.0         1.0  
2019-07-18           0.0           -1.0         0.0  
2019-07-19           0.0            0.0        -1.0  
2019-10-17           1.0            1.0         0.0  
2019-10-18           0.0           -1.0         1.0  
2019-10-21           0.0            0.0        -1.0  
2019-10-30           1.0            1.0         0.0  
2019-10-31           1.0            0.0         1.0  
2020-03-11           0.0           -1.0         0.0  
2020-03-12           0.0            0.0        -1.0  
2020-03-26           1.0            1.0         0.0  
2020-03-27           1.0            0.0         1.0  
2020-06-05           0.0           -1.0         0.0  
2020-06-08           0.0            0.0        -1.0  
2020-06-09           1.0            1.0         0.0  
2020-06-10           1.0            0.0         1.0  

List the signal change and entry/exit points for EMA_016_SlowMA_35_FastMA_10
            open_price  close_price     fast_ma     slow_ma  ma_change  \
date                                                                     
2019-01-07      302.10      315.340  277.423898  274.536780   2.887118   
2019-01-08      319.98      320.270  285.214224  277.192015   8.022209   
2019-05-13      352.29      345.260  364.831825  365.211176  -0.379351   
2019-05-14      348.71      345.610  361.336947  364.121897  -2.784949   
2019-06-21      365.00      369.210  357.528836  356.173461   1.355374   
2019-06-24      370.27      371.040  359.985411  356.999430   2.985981   
2019-07-18      323.76      325.210  362.349569  363.935179  -1.585609   
2019-07-19      323.40      315.100  353.758739  361.222055  -7.463316   
2019-11-01      288.70      286.810  282.483452  282.123011   0.360441   
2019-11-04      288.00      292.860  284.370097  282.719510   1.650587   
2020-03-12      326.50      315.250  355.726706  359.547458  -3.820751   
2020-03-13      330.51      336.295  352.193669  358.255654  -6.061985   
2020-03-30      363.00      370.960  352.062324  351.810361   0.251963   
2020-03-31      367.93      375.500  356.323720  353.126452   3.197268   

            trade_signal  signal_change  entry_exit  
date                                                 
2019-01-07           1.0            1.0         0.0  
2019-01-08           1.0            0.0         1.0  
2019-05-13           0.0           -1.0         0.0  
2019-05-14           0.0            0.0        -1.0  
2019-06-21           1.0            1.0         0.0  
2019-06-24           1.0            0.0         1.0  
2019-07-18           0.0           -1.0         0.0  
2019-07-19           0.0            0.0        -1.0  
2019-11-01           1.0            1.0         0.0  
2019-11-04           1.0            0.0         1.0  
2020-03-12           0.0           -1.0         0.0  
2020-03-13           0.0            0.0        -1.0  
2020-03-30           1.0            1.0         0.0  
2020-03-31           1.0            0.0         1.0  

List the signal change and entry/exit points for EMA_017_SlowMA_35_FastMA_15
            open_price  close_price     fast_ma     slow_ma  ma_change  \
date                                                                     
2019-01-08      319.98      320.270  279.599030  277.192015   2.407015   
2019-01-09      317.71      319.960  284.647006  279.668889   4.978117   
2019-05-14      348.71      345.610  363.847434  364.121897  -0.274463   
2019-05-15      343.34      354.990  362.740254  363.614426  -0.874172   
2019-06-24      370.27      371.040  357.862673  356.999430   0.863243   
2019-06-25      370.75      360.300  358.167339  357.182805   0.984533   
2019-07-19      323.40      315.100  358.402790  361.222055  -2.819265   
2019-07-22      312.00      310.620  352.429941  358.410772  -5.980831   
2019-11-05      289.99      288.030  283.246644  283.014538   0.232107   
2019-11-06      288.19      288.590  283.914564  283.324286   0.590278   
2020-03-13      330.51      336.295  357.256121  358.255654  -0.999533   
2020-03-16      306.63      298.840  349.954106  354.954785  -5.000678   
2020-03-31      367.93      375.500  353.819351  353.126452   0.692899   
2020-04-01      376.05      364.080  355.101932  353.734982   1.366950   

            trade_signal  signal_change  entry_exit  
date                                                 
2019-01-08           1.0            1.0         0.0  
2019-01-09           1.0            0.0         1.0  
2019-05-14           0.0           -1.0         0.0  
2019-05-15           0.0            0.0        -1.0  
2019-06-24           1.0            1.0         0.0  
2019-06-25           1.0            0.0         1.0  
2019-07-19           0.0           -1.0         0.0  
2019-07-22           0.0            0.0        -1.0  
2019-11-05           1.0            1.0         0.0  
2019-11-06           1.0            0.0         1.0  
2020-03-13           0.0           -1.0         0.0  
2020-03-16           0.0            0.0        -1.0  
2020-03-31           1.0            1.0         0.0  
2020-04-01           1.0            0.0         1.0  

List the signal change and entry/exit points for EMA_018_SlowMA_35_FastMA_20
            open_price  close_price     fast_ma     slow_ma  ma_change  \
date                                                                     
2019-01-08      319.98       320.27  277.448029  277.192015   0.256014   
2019-01-09      317.71       319.96  281.511745  279.668889   1.842856   
2019-05-17      356.39       354.45  362.549495  362.879257  -0.329762   
2019-05-20      351.23       348.11  361.174304  362.058548  -0.884243   
2019-06-24      370.27       371.04  357.059886  356.999430   0.060456   
2019-06-25      370.75       360.30  357.368469  357.182805   0.185663   
2019-07-19      323.40       315.10  360.188502  361.222055  -1.033553   
2019-07-22      312.00       310.62  355.467692  358.410772  -2.943080   
2019-11-08      288.73       291.57  284.284237  284.110088   0.174149   
2019-11-11      289.16       294.18  285.226691  284.669528   0.557163   
2020-03-16      306.63       298.84  353.643221  354.954785  -1.311564   
2020-03-17      306.18       319.75  350.415295  352.998963  -2.583668   
2020-03-31      367.93       375.50  353.416104  353.126452   0.289653   
2020-04-01      376.05       364.08  354.431714  353.734982   0.696731   

            trade_signal  signal_change  entry_exit  
date                                                 
2019-01-08           1.0            1.0         0.0  
2019-01-09           1.0            0.0         1.0  
2019-05-17           0.0           -1.0         0.0  
2019-05-20           0.0            0.0        -1.0  
2019-06-24           1.0            1.0         0.0  
2019-06-25           1.0            0.0         1.0  
2019-07-19           0.0           -1.0         0.0  
2019-07-22           0.0            0.0        -1.0  
2019-11-08           1.0            1.0         0.0  
2019-11-11           1.0            0.0         1.0  
2020-03-16           0.0           -1.0         0.0  
2020-03-17           0.0            0.0        -1.0  
2020-03-31           1.0            1.0         0.0  
2020-04-01           1.0            0.0         1.0  

List the signal change and entry/exit points for EMA_019_SlowMA_40_FastMA_05
            open_price  close_price     fast_ma     slow_ma  ma_change  \
date                                                                     
2019-01-04      281.88       297.57  275.730669  273.083775   2.646894   
2019-01-07      302.10       315.34  288.933780  275.293475  13.640304   
2019-04-15      350.71       348.87  356.738219  356.900436  -0.162217   
2019-04-16      355.00       359.46  357.645479  357.025559   0.619920   
2019-04-17      365.05       354.74  356.676986  356.913842  -0.236856   
2019-04-18      355.00       360.35  357.901324  357.081783   0.819541   
2019-04-22      359.70       377.34  364.380883  358.071805   6.309078   
2019-05-13      352.29       345.26  359.311786  364.241495  -4.929709   
2019-05-14      348.71       345.61  354.744524  363.331892  -8.587368   
2019-06-20      365.91       365.21  358.288204  355.672711   2.615493   
2019-06-21      365.00       369.21  361.928802  356.333208   5.595595   
2019-07-18      323.76       325.21  353.858302  363.533074  -9.674772   
2019-07-19      323.40       315.10  340.938868  361.170290 -20.231422   
2019-10-17      304.49       293.35  286.342638  286.001636   0.341002   
2019-10-18      289.36       275.30  282.661759  285.479603  -2.817844   
2019-10-21      272.89       278.05  281.124506  285.117182  -3.992676   
2019-10-31      291.00       287.41  284.323646  283.231255   1.092392   
2019-11-01      288.70       286.81  285.152431  283.405828   1.746603   
2020-03-11      358.92       349.92  359.463682  360.027331  -0.563649   
2020-03-12      326.50       315.25  344.725788  357.843071 -13.117283   
2020-03-26      344.00       362.99  350.341988  350.036550   0.305439   
2020-03-27      359.09       357.12  352.601326  350.382084   2.219242   

            trade_signal  signal_change  entry_exit  
date                                                 
2019-01-04           1.0            1.0         0.0  
2019-01-07           1.0            0.0         1.0  
2019-04-15           0.0           -1.0         0.0  
2019-04-16           1.0            1.0        -1.0  
2019-04-17           0.0           -1.0         1.0  
2019-04-18           1.0            1.0        -1.0  
2019-04-22           1.0            0.0         1.0  
2019-05-13           0.0           -1.0         0.0  
2019-05-14           0.0            0.0        -1.0  
2019-06-20           1.0            1.0         0.0  
2019-06-21           1.0            0.0         1.0  
2019-07-18           0.0           -1.0         0.0  
2019-07-19           0.0            0.0        -1.0  
2019-10-17           1.0            1.0         0.0  
2019-10-18           0.0           -1.0         1.0  
2019-10-21           0.0            0.0        -1.0  
2019-10-31           1.0            1.0         0.0  
2019-11-01           1.0            0.0         1.0  
2020-03-11           0.0           -1.0         0.0  
2020-03-12           0.0            0.0        -1.0  
2020-03-26           1.0            1.0         0.0  
2020-03-27           1.0            0.0         1.0  

List the signal change and entry/exit points for EMA_020_SlowMA_40_FastMA_10
            open_price  close_price     fast_ma     slow_ma  ma_change  \
date                                                                     
2019-01-07      302.10      315.340  277.423898  275.293475   2.130423   
2019-01-08      319.98      320.270  285.214224  277.637195   7.577029   
2019-05-14      348.71      345.610  361.336947  363.331892  -1.994945   
2019-05-15      343.34      354.990  360.182957  362.924651  -2.741694   
2019-06-21      365.00      369.210  357.528836  356.333208   1.195628   
2019-06-24      370.27      371.040  359.985411  357.050758   2.934653   
2019-07-18      323.76      325.210  362.349569  363.533074  -1.183504   
2019-07-19      323.40      315.100  353.758739  361.170290  -7.411551   
2019-11-04      288.00      292.860  284.370097  283.867008   0.503089   
2019-11-05      289.99      288.030  285.035534  284.070081   0.965453   
2020-03-12      326.50      315.250  355.726706  357.843071  -2.116365   
2020-03-13      330.51      336.295  352.193669  356.791946  -4.598277   
2020-03-30      363.00      370.960  352.062324  351.385885   0.676439   
2020-03-31      367.93      375.500  356.323720  352.562183   3.761537   

            trade_signal  signal_change  entry_exit  
date                                                 
2019-01-07           1.0            1.0         0.0  
2019-01-08           1.0            0.0         1.0  
2019-05-14           0.0           -1.0         0.0  
2019-05-15           0.0            0.0        -1.0  
2019-06-21           1.0            1.0         0.0  
2019-06-24           1.0            0.0         1.0  
2019-07-18           0.0           -1.0         0.0  
2019-07-19           0.0            0.0        -1.0  
2019-11-04           1.0            1.0         0.0  
2019-11-05           1.0            0.0         1.0  
2020-03-12           0.0           -1.0         0.0  
2020-03-13           0.0            0.0        -1.0  
2020-03-30           1.0            1.0         0.0  
2020-03-31           1.0            0.0         1.0  

List the signal change and entry/exit points for EMA_021_SlowMA_40_FastMA_15
            open_price  close_price     fast_ma     slow_ma  ma_change  \
date                                                                     
2019-01-08      319.98       320.27  279.599030  277.637195   1.961835   
2019-01-09      317.71       319.96  284.647006  279.835312   4.811694   
2019-05-15      343.34       354.99  362.740254  362.924651  -0.184397   
2019-05-16      356.37       359.31  362.311473  362.748195  -0.436723   
2019-06-24      370.27       371.04  357.862673  357.050758   0.811915   
2019-06-25      370.75       360.30  358.167339  357.209288   0.958051   
2019-07-19      323.40       315.10  358.402790  361.170290  -2.767500   
2019-07-22      312.00       310.62  352.429941  358.704228  -6.274287   
2019-11-07      290.70       289.57  284.621493  284.548099   0.073394   
2019-11-08      288.73       291.57  285.490057  284.890631   0.599425   
2020-03-16      306.63       298.84  349.954106  353.965021  -4.010915   
2020-03-17      306.18       319.75  346.178593  352.295996  -6.117403   
2020-03-31      367.93       375.50  353.819351  352.562183   1.257168   
2020-04-01      376.05       364.08  355.101932  353.124028   1.977904   

            trade_signal  signal_change  entry_exit  
date                                                 
2019-01-08           1.0            1.0         0.0  
2019-01-09           1.0            0.0         1.0  
2019-05-15           0.0           -1.0         0.0  
2019-05-16           0.0            0.0        -1.0  
2019-06-24           1.0            1.0         0.0  
2019-06-25           1.0            0.0         1.0  
2019-07-19           0.0           -1.0         0.0  
2019-07-22           0.0            0.0        -1.0  
2019-11-07           1.0            1.0         0.0  
2019-11-08           1.0            0.0         1.0  
2020-03-16           0.0           -1.0         0.0  
2020-03-17           0.0            0.0        -1.0  
2020-03-31           1.0            1.0         0.0  
2020-04-01           1.0            0.0         1.0  

List the signal change and entry/exit points for EMA_022_SlowMA_40_FastMA_20
            open_price  close_price     fast_ma     slow_ma  ma_change  \
date                                                                     
2019-01-09      317.71       319.96  281.511745  279.835312   1.676433   
2019-01-10      314.57       324.66  285.634833  282.156043   3.478790   
2019-05-20      351.23       348.11  361.174304  361.648351  -0.474047   
2019-05-21      350.95       354.27  360.516751  361.288200  -0.771449   
2019-06-24      370.27       371.04  357.059886  357.050758   0.009129   
2019-06-25      370.75       360.30  357.368469  357.209288   0.159181   
2019-07-19      323.40       315.10  360.188502  361.170290  -0.981788   
2019-07-22      312.00       310.62  355.467692  358.704228  -3.236536   
2019-11-12      295.32       292.01  285.872720  285.668954   0.203766   
2019-11-13      291.03       283.11  285.609604  285.544127   0.065477   
2020-03-16      306.63       298.84  353.643221  353.965021  -0.321801   
2020-03-17      306.18       319.75  350.415295  352.295996  -1.880701   
2020-03-31      367.93       375.50  353.416104  352.562183   0.853921   
2020-04-01      376.05       364.08  354.431714  353.124028   1.307686   

            trade_signal  signal_change  entry_exit  
date                                                 
2019-01-09           1.0            1.0         0.0  
2019-01-10           1.0            0.0         1.0  
2019-05-20           0.0           -1.0         0.0  
2019-05-21           0.0            0.0        -1.0  
2019-06-24           1.0            1.0         0.0  
2019-06-25           1.0            0.0         1.0  
2019-07-19           0.0           -1.0         0.0  
2019-07-22           0.0            0.0        -1.0  
2019-11-12           1.0            1.0         0.0  
2019-11-13           1.0            0.0         1.0  
2020-03-16           0.0           -1.0         0.0  
2020-03-17           0.0            0.0        -1.0  
2020-03-31           1.0            1.0         0.0  
2020-04-01           1.0            0.0         1.0  

List the signal change and entry/exit points for EMA_023_SlowMA_45_FastMA_05
            open_price  close_price     fast_ma     slow_ma  ma_change  \
date                                                                     
2019-01-04      281.88      297.570  275.730669  274.027704   1.702965   
2019-01-07      302.10      315.340  288.933780  276.003016  12.930763   
2019-05-13      352.29      345.260  359.311786  363.147351  -3.835566   
2019-05-14      348.71      345.610  354.744524  362.383472  -7.638948   
2019-06-20      365.91      365.210  358.288204  355.793544   2.494660   
2019-06-21      365.00      369.210  361.928802  356.377187   5.551616   
2019-07-18      323.76      325.210  353.858302  363.121323  -9.263021   
2019-07-19      323.40      315.100  340.938868  361.032950 -20.094081   
2019-11-01      288.70      286.810  285.152431  284.890309   0.262122   
2019-11-04      288.00      292.860  287.721621  285.236820   2.484800   
2020-03-12      326.50      315.250  344.725788  355.997124 -11.271336   
2020-03-13      330.51      336.295  341.915525  355.140510 -13.224984   
2020-03-26      344.00      362.990  350.341988  349.453249   0.888740   
2020-03-27      359.09      357.120  352.601326  349.786586   2.814740   

            trade_signal  signal_change  entry_exit  
date                                                 
2019-01-04           1.0            1.0         0.0  
2019-01-07           1.0            0.0         1.0  
2019-05-13           0.0           -1.0         0.0  
2019-05-14           0.0            0.0        -1.0  
2019-06-20           1.0            1.0         0.0  
2019-06-21           1.0            0.0         1.0  
2019-07-18           0.0           -1.0         0.0  
2019-07-19           0.0            0.0        -1.0  
2019-11-01           1.0            1.0         0.0  
2019-11-04           1.0            0.0         1.0  
2020-03-12           0.0           -1.0         0.0  
2020-03-13           0.0            0.0        -1.0  
2020-03-26           1.0            1.0         0.0  
2020-03-27           1.0            0.0         1.0  

List the signal change and entry/exit points for EMA_024_SlowMA_45_FastMA_10
            open_price  close_price     fast_ma     slow_ma  ma_change  \
date                                                                     
2019-01-07      302.10      315.340  277.423898  276.003016   1.420882   
2019-01-08      319.98      320.270  285.214224  278.110467   7.103757   
2019-05-14      348.71      345.610  361.336947  362.383472  -1.046525   
2019-05-15      343.34      354.990  360.182957  362.061458  -1.878501   
2019-06-21      365.00      369.210  357.528836  356.377187   1.151649   
2019-06-24      370.27      371.040  359.985411  357.015034   2.970377   
2019-07-18      323.76      325.210  362.349569  363.121323  -0.771754   
2019-07-19      323.40      315.100  353.758739  361.032950  -7.274211   
2019-11-06      288.19      288.590  285.681800  285.498775   0.183025   
2019-11-07      290.70      289.570  286.388746  285.675786   0.712959   
2020-03-12      326.50      315.250  355.726706  355.997124  -0.270417   
2020-03-13      330.51      336.295  352.193669  355.140510  -2.946841   
2020-03-30      363.00      370.960  352.062324  350.707169   1.355155   
2020-03-31      367.93      375.500  356.323720  351.785119   4.538601   

            trade_signal  signal_change  entry_exit  
date                                                 
2019-01-07           1.0            1.0         0.0  
2019-01-08           1.0            0.0         1.0  
2019-05-14           0.0           -1.0         0.0  
2019-05-15           0.0            0.0        -1.0  
2019-06-21           1.0            1.0         0.0  
2019-06-24           1.0            0.0         1.0  
2019-07-18           0.0           -1.0         0.0  
2019-07-19           0.0            0.0        -1.0  
2019-11-06           1.0            1.0         0.0  
2019-11-07           1.0            0.0         1.0  
2020-03-12           0.0           -1.0         0.0  
2020-03-13           0.0            0.0        -1.0  
2020-03-30           1.0            1.0         0.0  
2020-03-31           1.0            0.0         1.0  

List the signal change and entry/exit points for EMA_025_SlowMA_45_FastMA_15
            open_price  close_price     fast_ma     slow_ma  ma_change  \
date                                                                     
2019-01-08      319.98       320.27  279.599030  278.110467   1.488563   
2019-01-09      317.71       319.96  284.647006  280.094634   4.552372   
2019-05-17      356.39       354.45  361.328788  361.615389  -0.286601   
2019-05-20      351.23       348.11  359.676440  361.027306  -1.350866   
2019-06-24      370.27       371.04  357.862673  357.015034   0.847640   
2019-06-25      370.75       360.30  358.167339  357.157930   1.009409   
2019-07-19      323.40       315.10  358.402790  361.032950  -2.630160   
2019-07-22      312.00       310.62  352.429941  358.840590  -6.410649   
2019-11-11      289.16       294.18  286.576300  286.290667   0.285633   
2019-11-12      295.32       292.01  287.255512  286.539335   0.716177   
2020-03-16      306.63       298.84  349.954106  352.692661  -2.738555   
2020-03-17      306.18       319.75  346.178593  351.260371  -5.081778   
2020-03-30      363.00       370.96  350.722116  350.707169   0.014946   
2020-03-31      367.93       375.50  353.819351  351.785119   2.034233   

            trade_signal  signal_change  entry_exit  
date                                                 
2019-01-08           1.0            1.0         0.0  
2019-01-09           1.0            0.0         1.0  
2019-05-17           0.0           -1.0         0.0  
2019-05-20           0.0            0.0        -1.0  
2019-06-24           1.0            1.0         0.0  
2019-06-25           1.0            0.0         1.0  
2019-07-19           0.0           -1.0         0.0  
2019-07-22           0.0            0.0        -1.0  
2019-11-11           1.0            1.0         0.0  
2019-11-12           1.0            0.0         1.0  
2020-03-16           0.0           -1.0         0.0  
2020-03-17           0.0            0.0        -1.0  
2020-03-30           1.0            1.0         0.0  
2020-03-31           1.0            0.0         1.0  

List the signal change and entry/exit points for EMA_026_SlowMA_45_FastMA_20
            open_price  close_price     fast_ma     slow_ma  ma_change  \
date                                                                     
2019-01-09     317.710       319.96  281.511745  280.094634   1.417111   
2019-01-10     314.570       324.66  285.634833  282.199286   3.435547   
2019-05-21     350.950       354.27  360.516751  360.733082  -0.216331   
2019-05-22     358.010       359.73  360.441823  360.689409  -0.247587   
2019-06-24     370.270       371.04  357.059886  357.015034   0.044853   
2019-06-25     370.750       360.30  357.368469  357.157930   0.210539   
2019-07-19     323.400       315.10  360.188502  361.032950  -0.844448   
2019-07-22     312.000       310.62  355.467692  358.840590  -3.372898   
2019-11-18     296.000       302.57  288.349271  287.581496   0.767774   
2019-11-19     304.010       302.60  289.706483  288.234478   1.472005   
2020-03-17     306.180       319.75  350.415295  351.260371  -0.845076   
2020-03-18     302.395       315.47  347.087172  349.704268  -2.617096   
2020-03-30     363.000       370.96  351.091484  350.707169   0.384315   
2020-03-31     367.930       375.50  353.416104  351.785119   1.630986   

            trade_signal  signal_change  entry_exit  
date                                                 
2019-01-09           1.0            1.0         0.0  
2019-01-10           1.0            0.0         1.0  
2019-05-21           0.0           -1.0         0.0  
2019-05-22           0.0            0.0        -1.0  
2019-06-24           1.0            1.0         0.0  
2019-06-25           1.0            0.0         1.0  
2019-07-19           0.0           -1.0         0.0  
2019-07-22           0.0            0.0        -1.0  
2019-11-18           1.0            1.0         0.0  
2019-11-19           1.0            0.0         1.0  
2020-03-17           0.0           -1.0         0.0  
2020-03-18           0.0            0.0        -1.0  
2020-03-30           1.0            1.0         0.0  
2020-03-31           1.0            0.0         1.0  

List the signal change and entry/exit points for EMA_027_SlowMA_50_FastMA_05
            open_price  close_price     fast_ma     slow_ma  ma_change  \
date                                                                     
2019-01-04      281.88      297.570  275.730669  274.855477   0.875192   
2019-01-07      302.10      315.340  288.933780  276.650000  12.283780   
2019-05-13      352.29      345.260  359.311786  361.976994  -2.665208   
2019-05-14      348.71      345.610  354.744524  361.332954  -6.588431   
2019-06-20      365.91      365.210  358.288204  355.773805   2.514398   
2019-06-21      365.00      369.210  361.928802  356.301326   5.627477   
2019-07-18      323.76      325.210  353.858302  362.689950  -8.831648   
2019-07-19      323.40      315.100  340.938868  360.822666 -19.883798   
2019-11-04      288.00      292.860  287.721621  286.750361   0.971260   
2019-11-05      289.99      288.030  287.824414  286.800544   1.023870   
2020-03-12      326.50      315.250  344.725788  354.107398  -9.381610   
2020-03-13      330.51      336.295  341.915525  353.408872 -11.493346   
2020-03-26      344.00      362.990  350.341988  348.653847   1.688141   
2020-03-27      359.09      357.120  352.601326  348.985853   3.615472   

            trade_signal  signal_change  entry_exit  
date                                                 
2019-01-04           1.0            1.0         0.0  
2019-01-07           1.0            0.0         1.0  
2019-05-13           0.0           -1.0         0.0  
2019-05-14           0.0            0.0        -1.0  
2019-06-20           1.0            1.0         0.0  
2019-06-21           1.0            0.0         1.0  
2019-07-18           0.0           -1.0         0.0  
2019-07-19           0.0            0.0        -1.0  
2019-11-04           1.0            1.0         0.0  
2019-11-05           1.0            0.0         1.0  
2020-03-12           0.0           -1.0         0.0  
2020-03-13           0.0            0.0        -1.0  
2020-03-26           1.0            1.0         0.0  
2020-03-27           1.0            0.0         1.0  

List the signal change and entry/exit points for EMA_028_SlowMA_50_FastMA_10
            open_price  close_price     fast_ma     slow_ma  ma_change  \
date                                                                     
2019-01-07      302.10      315.340  277.423898  276.650000   0.773899   
2019-01-08      319.98      320.270  285.214224  278.573675   6.640550   
2019-05-15      343.34      354.990  360.182957  361.083393  -0.900436   
2019-05-16      356.37      359.310  360.024238  361.013629  -0.989391   
2019-06-21      365.00      369.210  357.528836  356.301326   1.227510   
2019-06-24      370.27      371.040  359.985411  356.879957   3.105454   
2019-07-18      323.76      325.210  362.349569  362.689950  -0.340380   
2019-07-19      323.40      315.100  353.758739  360.822666  -7.063927   
2019-11-08      288.73      291.570  287.330792  287.156715   0.174077   
2019-11-11      289.16      294.180  288.576103  287.432144   1.143958   
2020-03-13      330.51      336.295  352.193669  353.408872  -1.215203   
2020-03-16      306.63      298.840  342.493002  351.268914  -8.775912   
2020-03-30      363.00      370.960  352.062324  349.847585   2.214739   
2020-03-31      367.93      375.500  356.323720  350.853562   5.470157   

            trade_signal  signal_change  entry_exit  
date                                                 
2019-01-07           1.0            1.0         0.0  
2019-01-08           1.0            0.0         1.0  
2019-05-15           0.0           -1.0         0.0  
2019-05-16           0.0            0.0        -1.0  
2019-06-21           1.0            1.0         0.0  
2019-06-24           1.0            0.0         1.0  
2019-07-18           0.0           -1.0         0.0  
2019-07-19           0.0            0.0        -1.0  
2019-11-08           1.0            1.0         0.0  
2019-11-11           1.0            0.0         1.0  
2020-03-13           0.0           -1.0         0.0  
2020-03-16           0.0            0.0        -1.0  
2020-03-30           1.0            1.0         0.0  
2020-03-31           1.0            0.0         1.0  

List the signal change and entry/exit points for EMA_029_SlowMA_50_FastMA_15
            open_price  close_price     fast_ma     slow_ma  ma_change  \
date                                                                     
2019-01-08      319.98       320.27  279.599030  278.573675   1.025355   
2019-01-09      317.71       319.96  284.647006  280.389970   4.257036   
2019-05-20      351.23       348.11  359.676440  360.258105  -0.581665   
2019-05-21      350.95       354.27  359.000635  360.022620  -1.021985   
2019-06-24      370.27       371.04  357.862673  356.879957   0.982716   
2019-06-25      370.75       360.30  358.167339  357.014220   1.153119   
2019-07-19      323.40       315.10  358.402790  360.822666  -2.419876   
2019-07-22      312.00       310.62  352.429941  358.852909  -6.422968   
2019-11-15      290.59       295.03  288.089201  287.815298   0.273902   
2019-11-18      296.00       302.57  289.899300  288.393925   1.505376   
2020-03-16      306.63       298.84  349.954106  351.268914  -1.314808   
2020-03-17      306.18       319.75  346.178593  350.032878  -3.854285   
2020-03-30      363.00       370.96  350.722116  349.847585   0.874531   
2020-03-31      367.93       375.50  353.819351  350.853562   2.965789   

            trade_signal  signal_change  entry_exit  
date                                                 
2019-01-08           1.0            1.0         0.0  
2019-01-09           1.0            0.0         1.0  
2019-05-20           0.0           -1.0         0.0  
2019-05-21           0.0            0.0        -1.0  
2019-06-24           1.0            1.0         0.0  
2019-06-25           1.0            0.0         1.0  
2019-07-19           0.0           -1.0         0.0  
2019-07-22           0.0            0.0        -1.0  
2019-11-15           1.0            1.0         0.0  
2019-11-18           1.0            0.0         1.0  
2020-03-16           0.0           -1.0         0.0  
2020-03-17           0.0            0.0        -1.0  
2020-03-30           1.0            1.0         0.0  
2020-03-31           1.0            0.0         1.0  

List the signal change and entry/exit points for EMA_030_SlowMA_50_FastMA_20
            open_price  close_price     fast_ma     slow_ma  ma_change  \
date                                                                     
2019-01-09     317.710       319.96  281.511745  280.389970   1.121775   
2019-01-10     314.570       324.66  285.634833  282.323789   3.311045   
2019-05-23     355.500       352.21  359.657839  359.704397  -0.046557   
2019-05-24     355.410       354.39  359.156140  359.495472  -0.339331   
2019-06-24     370.270       371.04  357.059886  356.879957   0.179929   
2019-06-25     370.750       360.30  357.368469  357.014220   0.354249   
2019-07-19     323.400       315.10  360.188502  360.822666  -0.634164   
2019-07-22     312.000       310.62  355.467692  358.852909  -3.385217   
2019-11-19     304.010       302.60  289.706483  288.951035   0.755448   
2019-11-20     301.010       305.16  291.178246  289.586691   1.591555   
2020-03-18     302.395       315.47  347.087172  348.677470  -1.590298   
2020-03-19     324.330       332.03  345.653155  348.024627  -2.371472   
2020-03-27     359.090       357.12  349.000061  348.985853   0.014208   
2020-03-30     363.000       370.96  351.091484  349.847585   1.243899   

            trade_signal  signal_change  entry_exit  
date                                                 
2019-01-09           1.0            1.0         0.0  
2019-01-10           1.0            0.0         1.0  
2019-05-23           0.0           -1.0         0.0  
2019-05-24           0.0            0.0        -1.0  
2019-06-24           1.0            1.0         0.0  
2019-06-25           1.0            0.0         1.0  
2019-07-19           0.0           -1.0         0.0  
2019-07-22           0.0            0.0        -1.0  
2019-11-19           1.0            1.0         0.0  
2019-11-20           1.0            0.0         1.0  
2020-03-18           0.0           -1.0         0.0  
2020-03-19           0.0            0.0        -1.0  
2020-03-27           1.0            1.0         0.0  
2020-03-30           1.0            0.0         1.0  

In [15]:
if verbose:
    for key in model_collection:
        graph_data = model_collection[key].copy()
        title_string = "Exponential Moving Average Crossover Model for " + key
        fig = plt.figure(figsize=(16,9))
        ylabel = stock_symbol + ' price in $'
        ax1 = fig.add_subplot(111, ylabel=ylabel, title=title_string)
        graph_data['fast_ma'].plot(ax=ax1, color='b', lw=2.)
        graph_data['slow_ma'].plot(ax=ax1, color='r', lw=2.)
        graph_data['close_price'].plot(ax=ax1, color='g')
        ax1.plot(graph_data.loc[graph_data.entry_exit == 1].index, graph_data.close_price[graph_data.entry_exit == 1], '^', markersize=7, color='k',label='buy')
        ax1.plot(graph_data.loc[graph_data.entry_exit == -1].index, graph_data.close_price[graph_data.entry_exit == -1], 'v', markersize=7, color='k',label='sell')
        plt.legend(loc='upper left')
        plt.show()

Task 4. Back-test Model

In [16]:
def trading_portfolio_generation(initial_fund, trading_model):
    # Construct a portfolio to track the transactions and returns
    portfolio = pd.DataFrame(index=trading_model.index, columns=['trade_action', 'qty_onhand', 'cost_basis', 'sold_transaction', 'gain_loss', 'cash_onhand', 'position_value', 'total_position', 'accumu_return'])
    portfolio.iloc[0]['trade_action'] = 0
    portfolio.iloc[0]['qty_onhand'] = 0
    portfolio.iloc[0]['cost_basis'] = 0.00
    portfolio.iloc[0]['sold_transaction'] = 0.00
    portfolio.iloc[0]['gain_loss'] = 0.00
    portfolio.iloc[0]['cash_onhand'] = initial_capital
    portfolio.iloc[0]['position_value'] = 0.00
    portfolio.iloc[0]['total_position'] = initial_capital
    portfolio.iloc[0]['accumu_return'] = portfolio.iloc[0]['total_position'] - initial_fund
    recent_cost = 0

    # The conditional parameters below determine how the trading strategy will be carried out
    for i in range(1, len(portfolio)):
        if (trading_model.iloc[i]['entry_exit'] == 1) and (portfolio.iloc[i-1]['qty_onhand'] == 0):
            portfolio.iloc[i]['trade_action'] = 1
            portfolio.iloc[i]['qty_onhand'] = portfolio.iloc[i-1]['qty_onhand'] + portfolio.iloc[i]['trade_action']
            portfolio.iloc[i]['cost_basis'] = trading_model.iloc[i]['open_price'] * portfolio.iloc[i]['trade_action']
            portfolio.iloc[i]['sold_transaction'] = 0.00
            portfolio.iloc[i]['gain_loss'] = 0.00
            portfolio.iloc[i]['cash_onhand'] = portfolio.iloc[i-1]['cash_onhand'] - portfolio.iloc[i]['cost_basis']
            recent_cost = trading_model.iloc[i]['open_price'] * portfolio.iloc[i]['trade_action']
            if verbose: print('BOUGHT QTY:', portfolio.iloc[i]['trade_action'], 'on', portfolio.index[i], 'at the price of', trading_model.iloc[i]['open_price'])
        elif (trading_model.iloc[i]['entry_exit'] == -1) and (portfolio.iloc[i-1]['qty_onhand'] > 0):
            portfolio.iloc[i]['trade_action'] = -1
            portfolio.iloc[i]['qty_onhand'] = portfolio.iloc[i-1]['qty_onhand'] + portfolio.iloc[i]['trade_action']
            portfolio.iloc[i]['cost_basis'] = 0.00
            portfolio.iloc[i]['sold_transaction'] = trading_model.iloc[i]['open_price'] * portfolio.iloc[i]['trade_action'] * -1
            portfolio.iloc[i]['gain_loss'] = (recent_cost + (trading_model.iloc[i]['open_price'] * portfolio.iloc[i]['trade_action'])) * -1
            portfolio.iloc[i]['cash_onhand'] = portfolio.iloc[i-1]['cash_onhand'] + portfolio.iloc[i]['sold_transaction']
            recent_cost = 0.00
            if verbose: print('SOLD QTY:', portfolio.iloc[i]['trade_action'], 'on', portfolio.index[i], 'at the price of', trading_model.iloc[i]['open_price'])
        else:
            portfolio.iloc[i]['trade_action'] = 0
            portfolio.iloc[i]['qty_onhand'] = portfolio.iloc[i-1]['qty_onhand']
            portfolio.iloc[i]['cost_basis'] = portfolio.iloc[i-1]['cost_basis']
            portfolio.iloc[i]['sold_transaction'] = 0.00
            portfolio.iloc[i]['gain_loss'] = 0.00
            portfolio.iloc[i]['cash_onhand'] = portfolio.iloc[i-1]['cash_onhand']
        portfolio.iloc[i]['position_value'] = trading_model.iloc[i]['close_price'] * portfolio.iloc[i]['qty_onhand']
        portfolio.iloc[i]['total_position'] = portfolio.iloc[i]['cash_onhand'] + portfolio.iloc[i]['position_value']
        portfolio.iloc[i]['accumu_return'] = portfolio.iloc[i]['total_position'] - initial_fund

    return portfolio
In [17]:
portfolio_collection = {}

# Build dataframe for reporting model performance summary
performance_summary = pd.DataFrame(columns=['model_name','return_value','return_percent'])

for key in model_collection:
    print('Processing portfolio for model:', key)
    portfolio_collection[key] = trading_portfolio_generation(initial_capital, model_collection[key])
    trade_transactions = portfolio_collection[key][portfolio_collection[key].trade_action != 0]
    print(trade_transactions)
    print('Accumulated profit/loss for one share of stock with initial capital of $%.0f at the end of modeling period: $%.2f' % (initial_capital, portfolio_collection[key].accumu_return[-1]))
    if initial_capital != 0:
        return_percentage = portfolio_collection[key].accumu_return[-1] / initial_capital * 100
        print('Accumulated return percentage based on the initial capital investment: %.2f%%' % (return_percentage))
    else:
        return_percentage = None
    if trade_transactions.iloc[-1]['trade_action'] == 1:
        print('The current status of the model is:', 'Holding a position since', trade_transactions.index.tolist()[-1], '\n')
    else:
        print('The current status of the model is:', 'Waiting to enter since', trade_transactions.index.tolist()[-1], '\n')
    performance_summary = performance_summary.append({'model_name': key, 'return_value': portfolio_collection[key].accumu_return[-1],
                                                      'return_percent': return_percentage}, ignore_index=True)
Processing portfolio for model: EMA_001_SlowMA_10_FastMA_05
BOUGHT QTY: 1 on 2019-03-14 00:00:00 at the price of 360.5
SOLD QTY: -1 on 2019-03-28 00:00:00 at the price of 354.485
BOUGHT QTY: 1 on 2019-04-03 00:00:00 at the price of 369.26
SOLD QTY: -1 on 2019-04-15 00:00:00 at the price of 350.71
BOUGHT QTY: 1 on 2019-04-23 00:00:00 at the price of 375.45
SOLD QTY: -1 on 2019-05-09 00:00:00 at the price of 360.9
BOUGHT QTY: 1 on 2019-06-07 00:00:00 at the price of 357.39
SOLD QTY: -1 on 2019-06-13 00:00:00 at the price of 347.23
BOUGHT QTY: 1 on 2019-06-19 00:00:00 at the price of 361.72
SOLD QTY: -1 on 2019-07-16 00:00:00 at the price of 370.09
BOUGHT QTY: 1 on 2019-09-18 00:00:00 at the price of 294.99
SOLD QTY: -1 on 2019-09-20 00:00:00 at the price of 280.26
BOUGHT QTY: 1 on 2019-10-11 00:00:00 at the price of 284.8
SOLD QTY: -1 on 2019-10-23 00:00:00 at the price of 268.06
BOUGHT QTY: 1 on 2019-10-29 00:00:00 at the price of 281.87
SOLD QTY: -1 on 2019-12-06 00:00:00 at the price of 304.7
BOUGHT QTY: 1 on 2019-12-18 00:00:00 at the price of 316.26
SOLD QTY: -1 on 2020-01-23 00:00:00 at the price of 326.04
BOUGHT QTY: 1 on 2020-01-24 00:00:00 at the price of 348.46
SOLD QTY: -1 on 2020-02-26 00:00:00 at the price of 366.31
BOUGHT QTY: 1 on 2020-03-03 00:00:00 at the price of 381.03
SOLD QTY: -1 on 2020-03-04 00:00:00 at the price of 377.77
BOUGHT QTY: 1 on 2020-03-05 00:00:00 at the price of 381.0
SOLD QTY: -1 on 2020-03-09 00:00:00 at the price of 343.86
BOUGHT QTY: 1 on 2020-03-24 00:00:00 at the price of 369.99
SOLD QTY: -1 on 2020-05-26 00:00:00 at the price of 427.77
BOUGHT QTY: 1 on 2020-06-10 00:00:00 at the price of 436.0
SOLD QTY: -1 on 2020-06-15 00:00:00 at the price of 421.4
BOUGHT QTY: 1 on 2020-06-17 00:00:00 at the price of 441.82
           trade_action qty_onhand cost_basis sold_transaction gain_loss  \
date                                                                       
2019-03-14            1          1      360.5                0         0   
2019-03-28           -1          0          0          354.485    -6.015   
2019-04-03            1          1     369.26                0         0   
2019-04-15           -1          0          0           350.71    -18.55   
2019-04-23            1          1     375.45                0         0   
2019-05-09           -1          0          0            360.9    -14.55   
2019-06-07            1          1     357.39                0         0   
2019-06-13           -1          0          0           347.23    -10.16   
2019-06-19            1          1     361.72                0         0   
2019-07-16           -1          0          0           370.09      8.37   
2019-09-18            1          1     294.99                0         0   
2019-09-20           -1          0          0           280.26    -14.73   
2019-10-11            1          1      284.8                0         0   
2019-10-23           -1          0          0           268.06    -16.74   
2019-10-29            1          1     281.87                0         0   
2019-12-06           -1          0          0            304.7     22.83   
2019-12-18            1          1     316.26                0         0   
2020-01-23           -1          0          0           326.04      9.78   
2020-01-24            1          1     348.46                0         0   
2020-02-26           -1          0          0           366.31     17.85   
2020-03-03            1          1     381.03                0         0   
2020-03-04           -1          0          0           377.77     -3.26   
2020-03-05            1          1        381                0         0   
2020-03-09           -1          0          0           343.86    -37.14   
2020-03-24            1          1     369.99                0         0   
2020-05-26           -1          0          0           427.77     57.78   
2020-06-10            1          1        436                0         0   
2020-06-15           -1          0          0            421.4     -14.6   
2020-06-17            1          1     441.82                0         0   

           cash_onhand position_value total_position accumu_return  
date                                                                
2019-03-14      -360.5         358.82          -1.68         -1.68  
2019-03-28      -6.015              0         -6.015        -6.015  
2019-04-03    -375.275         369.75         -5.525        -5.525  
2019-04-15     -24.565              0        -24.565       -24.565  
2019-04-23    -400.015         381.89        -18.125       -18.125  
2019-05-09     -39.115              0        -39.115       -39.115  
2019-06-07    -396.505         360.87        -35.635       -35.635  
2019-06-13     -49.275              0        -49.275       -49.275  
2019-06-19    -410.995         363.52        -47.475       -47.475  
2019-07-16     -40.905              0        -40.905       -40.905  
2019-09-18    -335.895         291.56        -44.335       -44.335  
2019-09-20     -55.635              0        -55.635       -55.635  
2019-10-11    -340.435         282.93        -57.505       -57.505  
2019-10-23     -72.375              0        -72.375       -72.375  
2019-10-29    -354.245         281.21        -73.035       -73.035  
2019-12-06     -49.545              0        -49.545       -49.545  
2019-12-18    -365.805          320.8        -45.005       -45.005  
2020-01-23     -39.765              0        -39.765       -39.765  
2020-01-24    -388.225         353.16        -35.065       -35.065  
2020-02-26     -21.915              0        -21.915       -21.915  
2020-03-03    -402.945         368.77        -34.175       -34.175  
2020-03-04     -25.175              0        -25.175       -25.175  
2020-03-05    -406.175         372.78        -33.395       -33.395  
2020-03-09     -62.315              0        -62.315       -62.315  
2020-03-24    -432.305         357.32        -74.985       -74.985  
2020-05-26      -4.535              0         -4.535        -4.535  
2020-06-10    -440.535         434.48         -6.055        -6.055  
2020-06-15     -19.135              0        -19.135       -19.135  
2020-06-17    -460.955         447.77        -13.185       -13.185  
Accumulated profit/loss for one share of stock with initial capital of $0 at the end of modeling period: $24.68
The current status of the model is: Holding a position since 2020-06-17 00:00:00 

Processing portfolio for model: EMA_002_SlowMA_15_FastMA_05
BOUGHT QTY: 1 on 2019-01-04 00:00:00 at the price of 281.88
SOLD QTY: -1 on 2019-03-08 00:00:00 at the price of 345.75
BOUGHT QTY: 1 on 2019-03-13 00:00:00 at the price of 355.81
SOLD QTY: -1 on 2019-03-28 00:00:00 at the price of 354.485
BOUGHT QTY: 1 on 2019-04-02 00:00:00 at the price of 366.25
SOLD QTY: -1 on 2019-04-15 00:00:00 at the price of 350.71
BOUGHT QTY: 1 on 2019-04-23 00:00:00 at the price of 375.45
SOLD QTY: -1 on 2019-05-10 00:00:00 at the price of 361.62
BOUGHT QTY: 1 on 2019-06-10 00:00:00 at the price of 363.65
SOLD QTY: -1 on 2019-06-12 00:00:00 at the price of 351.82
BOUGHT QTY: 1 on 2019-06-20 00:00:00 at the price of 365.91
SOLD QTY: -1 on 2019-07-17 00:00:00 at the price of 366.25
BOUGHT QTY: 1 on 2019-09-18 00:00:00 at the price of 294.99
SOLD QTY: -1 on 2019-09-19 00:00:00 at the price of 291.56
BOUGHT QTY: 1 on 2019-10-11 00:00:00 at the price of 284.8
SOLD QTY: -1 on 2019-10-23 00:00:00 at the price of 268.06
BOUGHT QTY: 1 on 2019-10-29 00:00:00 at the price of 281.87
SOLD QTY: -1 on 2019-12-11 00:00:00 at the price of 294.49
BOUGHT QTY: 1 on 2019-12-18 00:00:00 at the price of 316.26
SOLD QTY: -1 on 2020-03-10 00:00:00 at the price of 356.425
BOUGHT QTY: 1 on 2020-03-25 00:00:00 at the price of 361.02
SOLD QTY: -1 on 2020-03-26 00:00:00 at the price of 344.0
BOUGHT QTY: 1 on 2020-03-27 00:00:00 at the price of 359.09
SOLD QTY: -1 on 2020-05-27 00:00:00 at the price of 410.38
BOUGHT QTY: 1 on 2020-06-11 00:00:00 at the price of 428.2
SOLD QTY: -1 on 2020-06-15 00:00:00 at the price of 421.4
BOUGHT QTY: 1 on 2020-06-17 00:00:00 at the price of 441.82
           trade_action qty_onhand cost_basis sold_transaction gain_loss  \
date                                                                       
2019-01-04            1          1     281.88                0         0   
2019-03-08           -1          0          0           345.75     63.87   
2019-03-13            1          1     355.81                0         0   
2019-03-28           -1          0          0          354.485    -1.325   
2019-04-02            1          1     366.25                0         0   
2019-04-15           -1          0          0           350.71    -15.54   
2019-04-23            1          1     375.45                0         0   
2019-05-10           -1          0          0           361.62    -13.83   
2019-06-10            1          1     363.65                0         0   
2019-06-12           -1          0          0           351.82    -11.83   
2019-06-20            1          1     365.91                0         0   
2019-07-17           -1          0          0           366.25      0.34   
2019-09-18            1          1     294.99                0         0   
2019-09-19           -1          0          0           291.56     -3.43   
2019-10-11            1          1      284.8                0         0   
2019-10-23           -1          0          0           268.06    -16.74   
2019-10-29            1          1     281.87                0         0   
2019-12-11           -1          0          0           294.49     12.62   
2019-12-18            1          1     316.26                0         0   
2020-03-10           -1          0          0          356.425    40.165   
2020-03-25            1          1     361.02                0         0   
2020-03-26           -1          0          0              344    -17.02   
2020-03-27            1          1     359.09                0         0   
2020-05-27           -1          0          0           410.38     51.29   
2020-06-11            1          1      428.2                0         0   
2020-06-15           -1          0          0            421.4      -6.8   
2020-06-17            1          1     441.82                0         0   

           cash_onhand position_value total_position accumu_return  
date                                                                
2019-01-04     -281.88         297.57          15.69         15.69  
2019-03-08       63.87              0          63.87         63.87  
2019-03-13     -291.94         361.21          69.27         69.27  
2019-03-28      62.545              0         62.545        62.545  
2019-04-02    -303.705         367.72         64.015        64.015  
2019-04-15      47.005              0         47.005        47.005  
2019-04-23    -328.445         381.89         53.445        53.445  
2019-05-10      33.175              0         33.175        33.175  
2019-06-10    -330.475         352.01         21.535        21.535  
2019-06-12      21.345              0         21.345        21.345  
2019-06-20    -344.565         365.21         20.645        20.645  
2019-07-17      21.685              0         21.685        21.685  
2019-09-18    -273.305         291.56         18.255        18.255  
2019-09-19      18.255              0         18.255        18.255  
2019-10-11    -266.545         282.93         16.385        16.385  
2019-10-23       1.515              0          1.515         1.515  
2019-10-29    -280.355         281.21          0.855         0.855  
2019-12-11      14.135              0         14.135        14.135  
2019-12-18    -302.125          320.8         18.675        18.675  
2020-03-10        54.3              0           54.3          54.3  
2020-03-25     -306.72         342.39          35.67         35.67  
2020-03-26       37.28              0          37.28         37.28  
2020-03-27     -321.81         357.12          35.31         35.31  
2020-05-27       88.57              0          88.57         88.57  
2020-06-11     -339.63         425.56          85.93         85.93  
2020-06-15       81.77              0          81.77         81.77  
2020-06-17     -360.05         447.77          87.72         87.72  
Accumulated profit/loss for one share of stock with initial capital of $0 at the end of modeling period: $125.59
The current status of the model is: Holding a position since 2020-06-17 00:00:00 

Processing portfolio for model: EMA_003_SlowMA_15_FastMA_10
BOUGHT QTY: 1 on 2019-01-07 00:00:00 at the price of 302.1
SOLD QTY: -1 on 2019-04-01 00:00:00 at the price of 359.0
BOUGHT QTY: 1 on 2019-04-02 00:00:00 at the price of 366.25
SOLD QTY: -1 on 2019-04-15 00:00:00 at the price of 350.71
BOUGHT QTY: 1 on 2019-04-23 00:00:00 at the price of 375.45
SOLD QTY: -1 on 2019-05-13 00:00:00 at the price of 352.29
BOUGHT QTY: 1 on 2019-06-20 00:00:00 at the price of 365.91
SOLD QTY: -1 on 2019-07-19 00:00:00 at the price of 323.4
BOUGHT QTY: 1 on 2019-10-15 00:00:00 at the price of 283.82
SOLD QTY: -1 on 2019-10-24 00:00:00 at the price of 271.81
BOUGHT QTY: 1 on 2019-10-30 00:00:00 at the price of 284.34
SOLD QTY: -1 on 2019-12-12 00:00:00 at the price of 295.67
BOUGHT QTY: 1 on 2019-12-18 00:00:00 at the price of 316.26
SOLD QTY: -1 on 2020-03-10 00:00:00 at the price of 356.425
BOUGHT QTY: 1 on 2020-03-30 00:00:00 at the price of 363.0
SOLD QTY: -1 on 2020-05-29 00:00:00 at the price of 417.46
BOUGHT QTY: 1 on 2020-06-17 00:00:00 at the price of 441.82
           trade_action qty_onhand cost_basis sold_transaction gain_loss  \
date                                                                       
2019-01-07            1          1      302.1                0         0   
2019-04-01           -1          0          0              359      56.9   
2019-04-02            1          1     366.25                0         0   
2019-04-15           -1          0          0           350.71    -15.54   
2019-04-23            1          1     375.45                0         0   
2019-05-13           -1          0          0           352.29    -23.16   
2019-06-20            1          1     365.91                0         0   
2019-07-19           -1          0          0            323.4    -42.51   
2019-10-15            1          1     283.82                0         0   
2019-10-24           -1          0          0           271.81    -12.01   
2019-10-30            1          1     284.34                0         0   
2019-12-12           -1          0          0           295.67     11.33   
2019-12-18            1          1     316.26                0         0   
2020-03-10           -1          0          0          356.425    40.165   
2020-03-30            1          1        363                0         0   
2020-05-29           -1          0          0           417.46     54.46   
2020-06-17            1          1     441.82                0         0   

           cash_onhand position_value total_position accumu_return  
date                                                                
2019-01-07      -302.1         315.34          13.24         13.24  
2019-04-01        56.9              0           56.9          56.9  
2019-04-02     -309.35         367.72          58.37         58.37  
2019-04-15       41.36              0          41.36         41.36  
2019-04-23     -334.09         381.89           47.8          47.8  
2019-05-13        18.2              0           18.2          18.2  
2019-06-20     -347.71         365.21           17.5          17.5  
2019-07-19      -24.31              0         -24.31        -24.31  
2019-10-15     -308.13         284.25         -23.88        -23.88  
2019-10-24      -36.32              0         -36.32        -36.32  
2019-10-30     -320.66         291.45         -29.21        -29.21  
2019-12-12      -24.99              0         -24.99        -24.99  
2019-12-18     -341.25          320.8         -20.45        -20.45  
2020-03-10      15.175              0         15.175        15.175  
2020-03-30    -347.825         370.96         23.135        23.135  
2020-05-29      69.635              0         69.635        69.635  
2020-06-17    -372.185         447.77         75.585        75.585  
Accumulated profit/loss for one share of stock with initial capital of $0 at the end of modeling period: $113.45
The current status of the model is: Holding a position since 2020-06-17 00:00:00 

Processing portfolio for model: EMA_004_SlowMA_20_FastMA_05
BOUGHT QTY: 1 on 2019-01-07 00:00:00 at the price of 302.1
SOLD QTY: -1 on 2019-03-29 00:00:00 at the price of 357.16
BOUGHT QTY: 1 on 2019-04-02 00:00:00 at the price of 366.25
SOLD QTY: -1 on 2019-04-15 00:00:00 at the price of 350.71
BOUGHT QTY: 1 on 2019-04-23 00:00:00 at the price of 375.45
SOLD QTY: -1 on 2019-05-10 00:00:00 at the price of 361.62
BOUGHT QTY: 1 on 2019-06-10 00:00:00 at the price of 363.65
SOLD QTY: -1 on 2019-06-11 00:00:00 at the price of 355.0
BOUGHT QTY: 1 on 2019-06-20 00:00:00 at the price of 365.91
SOLD QTY: -1 on 2019-07-18 00:00:00 at the price of 323.76
BOUGHT QTY: 1 on 2019-10-14 00:00:00 at the price of 283.93
SOLD QTY: -1 on 2019-10-23 00:00:00 at the price of 268.06
BOUGHT QTY: 1 on 2019-10-30 00:00:00 at the price of 284.34
SOLD QTY: -1 on 2019-12-11 00:00:00 at the price of 294.49
BOUGHT QTY: 1 on 2019-12-18 00:00:00 at the price of 316.26
SOLD QTY: -1 on 2020-03-10 00:00:00 at the price of 356.425
BOUGHT QTY: 1 on 2020-03-27 00:00:00 at the price of 359.09
SOLD QTY: -1 on 2020-05-27 00:00:00 at the price of 410.38
BOUGHT QTY: 1 on 2020-06-11 00:00:00 at the price of 428.2
SOLD QTY: -1 on 2020-06-15 00:00:00 at the price of 421.4
BOUGHT QTY: 1 on 2020-06-17 00:00:00 at the price of 441.82
           trade_action qty_onhand cost_basis sold_transaction gain_loss  \
date                                                                       
2019-01-07            1          1      302.1                0         0   
2019-03-29           -1          0          0           357.16     55.06   
2019-04-02            1          1     366.25                0         0   
2019-04-15           -1          0          0           350.71    -15.54   
2019-04-23            1          1     375.45                0         0   
2019-05-10           -1          0          0           361.62    -13.83   
2019-06-10            1          1     363.65                0         0   
2019-06-11           -1          0          0              355     -8.65   
2019-06-20            1          1     365.91                0         0   
2019-07-18           -1          0          0           323.76    -42.15   
2019-10-14            1          1     283.93                0         0   
2019-10-23           -1          0          0           268.06    -15.87   
2019-10-30            1          1     284.34                0         0   
2019-12-11           -1          0          0           294.49     10.15   
2019-12-18            1          1     316.26                0         0   
2020-03-10           -1          0          0          356.425    40.165   
2020-03-27            1          1     359.09                0         0   
2020-05-27           -1          0          0           410.38     51.29   
2020-06-11            1          1      428.2                0         0   
2020-06-15           -1          0          0            421.4      -6.8   
2020-06-17            1          1     441.82                0         0   

           cash_onhand position_value total_position accumu_return  
date                                                                
2019-01-07      -302.1         315.34          13.24         13.24  
2019-03-29       55.06              0          55.06         55.06  
2019-04-02     -311.19         367.72          56.53         56.53  
2019-04-15       39.52              0          39.52         39.52  
2019-04-23     -335.93         381.89          45.96         45.96  
2019-05-10       25.69              0          25.69         25.69  
2019-06-10     -337.96         352.01          14.05         14.05  
2019-06-11       17.04              0          17.04         17.04  
2019-06-20     -348.87         365.21          16.34         16.34  
2019-07-18      -25.11              0         -25.11        -25.11  
2019-10-14     -309.04         285.53         -23.51        -23.51  
2019-10-23      -40.98              0         -40.98        -40.98  
2019-10-30     -325.32         291.45         -33.87        -33.87  
2019-12-11      -30.83              0         -30.83        -30.83  
2019-12-18     -347.09          320.8         -26.29        -26.29  
2020-03-10       9.335              0          9.335         9.335  
2020-03-27    -349.755         357.12          7.365         7.365  
2020-05-27      60.625              0         60.625        60.625  
2020-06-11    -367.575         425.56         57.985        57.985  
2020-06-15      53.825              0         53.825        53.825  
2020-06-17    -387.995         447.77         59.775        59.775  
Accumulated profit/loss for one share of stock with initial capital of $0 at the end of modeling period: $97.65
The current status of the model is: Holding a position since 2020-06-17 00:00:00 

Processing portfolio for model: EMA_005_SlowMA_20_FastMA_10
BOUGHT QTY: 1 on 2019-01-07 00:00:00 at the price of 302.1
SOLD QTY: -1 on 2019-04-16 00:00:00 at the price of 355.0
BOUGHT QTY: 1 on 2019-04-23 00:00:00 at the price of 375.45
SOLD QTY: -1 on 2019-05-14 00:00:00 at the price of 348.71
BOUGHT QTY: 1 on 2019-06-21 00:00:00 at the price of 365.0
SOLD QTY: -1 on 2019-07-19 00:00:00 at the price of 323.4
BOUGHT QTY: 1 on 2019-10-16 00:00:00 at the price of 283.12
SOLD QTY: -1 on 2019-10-23 00:00:00 at the price of 268.06
BOUGHT QTY: 1 on 2019-10-31 00:00:00 at the price of 291.0
SOLD QTY: -1 on 2020-03-10 00:00:00 at the price of 356.425
BOUGHT QTY: 1 on 2020-03-31 00:00:00 at the price of 367.93
SOLD QTY: -1 on 2020-06-01 00:00:00 at the price of 418.83
BOUGHT QTY: 1 on 2020-06-11 00:00:00 at the price of 428.2
SOLD QTY: -1 on 2020-06-12 00:00:00 at the price of 429.0
BOUGHT QTY: 1 on 2020-06-17 00:00:00 at the price of 441.82
           trade_action qty_onhand cost_basis sold_transaction gain_loss  \
date                                                                       
2019-01-07            1          1      302.1                0         0   
2019-04-16           -1          0          0              355      52.9   
2019-04-23            1          1     375.45                0         0   
2019-05-14           -1          0          0           348.71    -26.74   
2019-06-21            1          1        365                0         0   
2019-07-19           -1          0          0            323.4     -41.6   
2019-10-16            1          1     283.12                0         0   
2019-10-23           -1          0          0           268.06    -15.06   
2019-10-31            1          1        291                0         0   
2020-03-10           -1          0          0          356.425    65.425   
2020-03-31            1          1     367.93                0         0   
2020-06-01           -1          0          0           418.83      50.9   
2020-06-11            1          1      428.2                0         0   
2020-06-12           -1          0          0              429       0.8   
2020-06-17            1          1     441.82                0         0   

           cash_onhand position_value total_position accumu_return  
date                                                                
2019-01-07      -302.1         315.34          13.24         13.24  
2019-04-16        52.9              0           52.9          52.9  
2019-04-23     -322.55         381.89          59.34         59.34  
2019-05-14       26.16              0          26.16         26.16  
2019-06-21     -338.84         369.21          30.37         30.37  
2019-07-19      -15.44              0         -15.44        -15.44  
2019-10-16     -298.56         286.28         -12.28        -12.28  
2019-10-23       -30.5              0          -30.5         -30.5  
2019-10-31      -321.5         287.41         -34.09        -34.09  
2020-03-10      34.925              0         34.925        34.925  
2020-03-31    -333.005          375.5         42.495        42.495  
2020-06-01      85.825              0         85.825        85.825  
2020-06-11    -342.375         425.56         83.185        83.185  
2020-06-12      86.625              0         86.625        86.625  
2020-06-17    -355.195         447.77         92.575        92.575  
Accumulated profit/loss for one share of stock with initial capital of $0 at the end of modeling period: $130.44
The current status of the model is: Holding a position since 2020-06-17 00:00:00 

Processing portfolio for model: EMA_006_SlowMA_20_FastMA_15
BOUGHT QTY: 1 on 2019-01-08 00:00:00 at the price of 319.98
SOLD QTY: -1 on 2019-04-16 00:00:00 at the price of 355.0
BOUGHT QTY: 1 on 2019-04-23 00:00:00 at the price of 375.45
SOLD QTY: -1 on 2019-05-14 00:00:00 at the price of 348.71
BOUGHT QTY: 1 on 2019-06-24 00:00:00 at the price of 370.27
SOLD QTY: -1 on 2019-07-19 00:00:00 at the price of 323.4
BOUGHT QTY: 1 on 2019-10-18 00:00:00 at the price of 289.36
SOLD QTY: -1 on 2019-10-21 00:00:00 at the price of 272.89
BOUGHT QTY: 1 on 2019-10-31 00:00:00 at the price of 291.0
SOLD QTY: -1 on 2020-03-12 00:00:00 at the price of 326.5
BOUGHT QTY: 1 on 2020-04-01 00:00:00 at the price of 376.05
SOLD QTY: -1 on 2020-06-05 00:00:00 at the price of 407.29
BOUGHT QTY: 1 on 2020-06-11 00:00:00 at the price of 428.2
SOLD QTY: -1 on 2020-06-15 00:00:00 at the price of 421.4
BOUGHT QTY: 1 on 2020-06-17 00:00:00 at the price of 441.82
           trade_action qty_onhand cost_basis sold_transaction gain_loss  \
date                                                                       
2019-01-08            1          1     319.98                0         0   
2019-04-16           -1          0          0              355     35.02   
2019-04-23            1          1     375.45                0         0   
2019-05-14           -1          0          0           348.71    -26.74   
2019-06-24            1          1     370.27                0         0   
2019-07-19           -1          0          0            323.4    -46.87   
2019-10-18            1          1     289.36                0         0   
2019-10-21           -1          0          0           272.89    -16.47   
2019-10-31            1          1        291                0         0   
2020-03-12           -1          0          0            326.5      35.5   
2020-04-01            1          1     376.05                0         0   
2020-06-05           -1          0          0           407.29     31.24   
2020-06-11            1          1      428.2                0         0   
2020-06-15           -1          0          0            421.4      -6.8   
2020-06-17            1          1     441.82                0         0   

           cash_onhand position_value total_position accumu_return  
date                                                                
2019-01-08     -319.98         320.27           0.29          0.29  
2019-04-16       35.02              0          35.02         35.02  
2019-04-23     -340.43         381.89          41.46         41.46  
2019-05-14        8.28              0           8.28          8.28  
2019-06-24     -361.99         371.04           9.05          9.05  
2019-07-19      -38.59              0         -38.59        -38.59  
2019-10-18     -327.95          275.3         -52.65        -52.65  
2019-10-21      -55.06              0         -55.06        -55.06  
2019-10-31     -346.06         287.41         -58.65        -58.65  
2020-03-12      -19.56              0         -19.56        -19.56  
2020-04-01     -395.61         364.08         -31.53        -31.53  
2020-06-05       11.68              0          11.68         11.68  
2020-06-11     -416.52         425.56           9.04          9.04  
2020-06-15        4.88              0           4.88          4.88  
2020-06-17     -436.94         447.77          10.83         10.83  
Accumulated profit/loss for one share of stock with initial capital of $0 at the end of modeling period: $48.70
The current status of the model is: Holding a position since 2020-06-17 00:00:00 

Processing portfolio for model: EMA_007_SlowMA_25_FastMA_05
BOUGHT QTY: 1 on 2019-01-07 00:00:00 at the price of 302.1
SOLD QTY: -1 on 2019-04-01 00:00:00 at the price of 359.0
BOUGHT QTY: 1 on 2019-04-02 00:00:00 at the price of 366.25
SOLD QTY: -1 on 2019-04-15 00:00:00 at the price of 350.71
BOUGHT QTY: 1 on 2019-04-23 00:00:00 at the price of 375.45
SOLD QTY: -1 on 2019-05-13 00:00:00 at the price of 352.29
BOUGHT QTY: 1 on 2019-06-20 00:00:00 at the price of 365.91
SOLD QTY: -1 on 2019-07-19 00:00:00 at the price of 323.4
BOUGHT QTY: 1 on 2019-10-15 00:00:00 at the price of 283.82
SOLD QTY: -1 on 2019-10-23 00:00:00 at the price of 268.06
BOUGHT QTY: 1 on 2019-10-30 00:00:00 at the price of 284.34
SOLD QTY: -1 on 2019-12-12 00:00:00 at the price of 295.67
BOUGHT QTY: 1 on 2019-12-17 00:00:00 at the price of 307.36
SOLD QTY: -1 on 2020-03-10 00:00:00 at the price of 356.425
BOUGHT QTY: 1 on 2020-03-27 00:00:00 at the price of 359.09
SOLD QTY: -1 on 2020-05-29 00:00:00 at the price of 417.46
BOUGHT QTY: 1 on 2020-06-10 00:00:00 at the price of 436.0
SOLD QTY: -1 on 2020-06-15 00:00:00 at the price of 421.4
BOUGHT QTY: 1 on 2020-06-17 00:00:00 at the price of 441.82
           trade_action qty_onhand cost_basis sold_transaction gain_loss  \
date                                                                       
2019-01-07            1          1      302.1                0         0   
2019-04-01           -1          0          0              359      56.9   
2019-04-02            1          1     366.25                0         0   
2019-04-15           -1          0          0           350.71    -15.54   
2019-04-23            1          1     375.45                0         0   
2019-05-13           -1          0          0           352.29    -23.16   
2019-06-20            1          1     365.91                0         0   
2019-07-19           -1          0          0            323.4    -42.51   
2019-10-15            1          1     283.82                0         0   
2019-10-23           -1          0          0           268.06    -15.76   
2019-10-30            1          1     284.34                0         0   
2019-12-12           -1          0          0           295.67     11.33   
2019-12-17            1          1     307.36                0         0   
2020-03-10           -1          0          0          356.425    49.065   
2020-03-27            1          1     359.09                0         0   
2020-05-29           -1          0          0           417.46     58.37   
2020-06-10            1          1        436                0         0   
2020-06-15           -1          0          0            421.4     -14.6   
2020-06-17            1          1     441.82                0         0   

           cash_onhand position_value total_position accumu_return  
date                                                                
2019-01-07      -302.1         315.34          13.24         13.24  
2019-04-01        56.9              0           56.9          56.9  
2019-04-02     -309.35         367.72          58.37         58.37  
2019-04-15       41.36              0          41.36         41.36  
2019-04-23     -334.09         381.89           47.8          47.8  
2019-05-13        18.2              0           18.2          18.2  
2019-06-20     -347.71         365.21           17.5          17.5  
2019-07-19      -24.31              0         -24.31        -24.31  
2019-10-15     -308.13         284.25         -23.88        -23.88  
2019-10-23      -40.07              0         -40.07        -40.07  
2019-10-30     -324.41         291.45         -32.96        -32.96  
2019-12-12      -28.74              0         -28.74        -28.74  
2019-12-17      -336.1         315.48         -20.62        -20.62  
2020-03-10      20.325              0         20.325        20.325  
2020-03-27    -338.765         357.12         18.355        18.355  
2020-05-29      78.695              0         78.695        78.695  
2020-06-10    -357.305         434.48         77.175        77.175  
2020-06-15      64.095              0         64.095        64.095  
2020-06-17    -377.725         447.77         70.045        70.045  
Accumulated profit/loss for one share of stock with initial capital of $0 at the end of modeling period: $107.91
The current status of the model is: Holding a position since 2020-06-17 00:00:00 

Processing portfolio for model: EMA_008_SlowMA_25_FastMA_10
BOUGHT QTY: 1 on 2019-01-08 00:00:00 at the price of 319.98
SOLD QTY: -1 on 2019-04-16 00:00:00 at the price of 355.0
BOUGHT QTY: 1 on 2019-04-23 00:00:00 at the price of 375.45
SOLD QTY: -1 on 2019-05-14 00:00:00 at the price of 348.71
BOUGHT QTY: 1 on 2019-06-21 00:00:00 at the price of 365.0
SOLD QTY: -1 on 2019-07-19 00:00:00 at the price of 323.4
BOUGHT QTY: 1 on 2019-10-18 00:00:00 at the price of 289.36
SOLD QTY: -1 on 2019-10-23 00:00:00 at the price of 268.06
BOUGHT QTY: 1 on 2019-10-31 00:00:00 at the price of 291.0
SOLD QTY: -1 on 2020-03-12 00:00:00 at the price of 326.5
BOUGHT QTY: 1 on 2020-03-31 00:00:00 at the price of 367.93
SOLD QTY: -1 on 2020-06-05 00:00:00 at the price of 407.29
BOUGHT QTY: 1 on 2020-06-11 00:00:00 at the price of 428.2
SOLD QTY: -1 on 2020-06-15 00:00:00 at the price of 421.4
BOUGHT QTY: 1 on 2020-06-16 00:00:00 at the price of 425.76
           trade_action qty_onhand cost_basis sold_transaction gain_loss  \
date                                                                       
2019-01-08            1          1     319.98                0         0   
2019-04-16           -1          0          0              355     35.02   
2019-04-23            1          1     375.45                0         0   
2019-05-14           -1          0          0           348.71    -26.74   
2019-06-21            1          1        365                0         0   
2019-07-19           -1          0          0            323.4     -41.6   
2019-10-18            1          1     289.36                0         0   
2019-10-23           -1          0          0           268.06     -21.3   
2019-10-31            1          1        291                0         0   
2020-03-12           -1          0          0            326.5      35.5   
2020-03-31            1          1     367.93                0         0   
2020-06-05           -1          0          0           407.29     39.36   
2020-06-11            1          1      428.2                0         0   
2020-06-15           -1          0          0            421.4      -6.8   
2020-06-16            1          1     425.76                0         0   

           cash_onhand position_value total_position accumu_return  
date                                                                
2019-01-08     -319.98         320.27           0.29          0.29  
2019-04-16       35.02              0          35.02         35.02  
2019-04-23     -340.43         381.89          41.46         41.46  
2019-05-14        8.28              0           8.28          8.28  
2019-06-21     -356.72         369.21          12.49         12.49  
2019-07-19      -33.32              0         -33.32        -33.32  
2019-10-18     -322.68          275.3         -47.38        -47.38  
2019-10-23      -54.62              0         -54.62        -54.62  
2019-10-31     -345.62         287.41         -58.21        -58.21  
2020-03-12      -19.12              0         -19.12        -19.12  
2020-03-31     -387.05          375.5         -11.55        -11.55  
2020-06-05       20.24              0          20.24         20.24  
2020-06-11     -407.96         425.56           17.6          17.6  
2020-06-15       13.44              0          13.44         13.44  
2020-06-16     -412.32         436.13          23.81         23.81  
Accumulated profit/loss for one share of stock with initial capital of $0 at the end of modeling period: $73.32
The current status of the model is: Holding a position since 2020-06-16 00:00:00 

Processing portfolio for model: EMA_009_SlowMA_25_FastMA_15
BOUGHT QTY: 1 on 2019-01-08 00:00:00 at the price of 319.98
SOLD QTY: -1 on 2019-04-18 00:00:00 at the price of 355.0
BOUGHT QTY: 1 on 2019-04-22 00:00:00 at the price of 359.7
SOLD QTY: -1 on 2019-05-14 00:00:00 at the price of 348.71
BOUGHT QTY: 1 on 2019-06-24 00:00:00 at the price of 370.27
SOLD QTY: -1 on 2019-07-19 00:00:00 at the price of 323.4
BOUGHT QTY: 1 on 2019-11-01 00:00:00 at the price of 288.7
SOLD QTY: -1 on 2020-03-13 00:00:00 at the price of 330.51
BOUGHT QTY: 1 on 2020-04-01 00:00:00 at the price of 376.05
           trade_action qty_onhand cost_basis sold_transaction gain_loss  \
date                                                                       
2019-01-08            1          1     319.98                0         0   
2019-04-18           -1          0          0              355     35.02   
2019-04-22            1          1      359.7                0         0   
2019-05-14           -1          0          0           348.71    -10.99   
2019-06-24            1          1     370.27                0         0   
2019-07-19           -1          0          0            323.4    -46.87   
2019-11-01            1          1      288.7                0         0   
2020-03-13           -1          0          0           330.51     41.81   
2020-04-01            1          1     376.05                0         0   

           cash_onhand position_value total_position accumu_return  
date                                                                
2019-01-08     -319.98         320.27           0.29          0.29  
2019-04-18       35.02              0          35.02         35.02  
2019-04-22     -324.68         377.34          52.66         52.66  
2019-05-14       24.03              0          24.03         24.03  
2019-06-24     -346.24         371.04           24.8          24.8  
2019-07-19      -22.84              0         -22.84        -22.84  
2019-11-01     -311.54         286.81         -24.73        -24.73  
2020-03-13       18.97              0          18.97         18.97  
2020-04-01     -357.08         364.08              7             7  
Accumulated profit/loss for one share of stock with initial capital of $0 at the end of modeling period: $128.56
The current status of the model is: Holding a position since 2020-04-01 00:00:00 

Processing portfolio for model: EMA_010_SlowMA_25_FastMA_20
BOUGHT QTY: 1 on 2019-01-09 00:00:00 at the price of 317.71
SOLD QTY: -1 on 2019-05-15 00:00:00 at the price of 343.34
BOUGHT QTY: 1 on 2019-06-25 00:00:00 at the price of 370.75
SOLD QTY: -1 on 2019-07-22 00:00:00 at the price of 312.0
BOUGHT QTY: 1 on 2019-11-05 00:00:00 at the price of 289.99
SOLD QTY: -1 on 2020-03-13 00:00:00 at the price of 330.51
BOUGHT QTY: 1 on 2020-04-02 00:00:00 at the price of 364.08
           trade_action qty_onhand cost_basis sold_transaction gain_loss  \
date                                                                       
2019-01-09            1          1     317.71                0         0   
2019-05-15           -1          0          0           343.34     25.63   
2019-06-25            1          1     370.75                0         0   
2019-07-22           -1          0          0              312    -58.75   
2019-11-05            1          1     289.99                0         0   
2020-03-13           -1          0          0           330.51     40.52   
2020-04-02            1          1     364.08                0         0   

           cash_onhand position_value total_position accumu_return  
date                                                                
2019-01-09     -317.71         319.96           2.25          2.25  
2019-05-15       25.63              0          25.63         25.63  
2019-06-25     -345.12          360.3          15.18         15.18  
2019-07-22      -33.12              0         -33.12        -33.12  
2019-11-05     -323.11         288.03         -35.08        -35.08  
2020-03-13         7.4              0            7.4           7.4  
2020-04-02     -356.68         370.08           13.4          13.4  
Accumulated profit/loss for one share of stock with initial capital of $0 at the end of modeling period: $128.96
The current status of the model is: Holding a position since 2020-04-02 00:00:00 

Processing portfolio for model: EMA_011_SlowMA_30_FastMA_05
BOUGHT QTY: 1 on 2019-01-07 00:00:00 at the price of 302.1
SOLD QTY: -1 on 2019-04-16 00:00:00 at the price of 355.0
BOUGHT QTY: 1 on 2019-04-23 00:00:00 at the price of 375.45
SOLD QTY: -1 on 2019-05-13 00:00:00 at the price of 352.29
BOUGHT QTY: 1 on 2019-06-20 00:00:00 at the price of 365.91
SOLD QTY: -1 on 2019-07-19 00:00:00 at the price of 323.4
BOUGHT QTY: 1 on 2019-10-16 00:00:00 at the price of 283.12
SOLD QTY: -1 on 2019-10-22 00:00:00 at the price of 271.159
BOUGHT QTY: 1 on 2019-10-31 00:00:00 at the price of 291.0
SOLD QTY: -1 on 2020-03-10 00:00:00 at the price of 356.425
BOUGHT QTY: 1 on 2020-03-27 00:00:00 at the price of 359.09
SOLD QTY: -1 on 2020-05-29 00:00:00 at the price of 417.46
BOUGHT QTY: 1 on 2020-06-02 00:00:00 at the price of 425.87
SOLD QTY: -1 on 2020-06-05 00:00:00 at the price of 407.29
BOUGHT QTY: 1 on 2020-06-10 00:00:00 at the price of 436.0
           trade_action qty_onhand cost_basis sold_transaction gain_loss  \
date                                                                       
2019-01-07            1          1      302.1                0         0   
2019-04-16           -1          0          0              355      52.9   
2019-04-23            1          1     375.45                0         0   
2019-05-13           -1          0          0           352.29    -23.16   
2019-06-20            1          1     365.91                0         0   
2019-07-19           -1          0          0            323.4    -42.51   
2019-10-16            1          1     283.12                0         0   
2019-10-22           -1          0          0          271.159   -11.961   
2019-10-31            1          1        291                0         0   
2020-03-10           -1          0          0          356.425    65.425   
2020-03-27            1          1     359.09                0         0   
2020-05-29           -1          0          0           417.46     58.37   
2020-06-02            1          1     425.87                0         0   
2020-06-05           -1          0          0           407.29    -18.58   
2020-06-10            1          1        436                0         0   

           cash_onhand position_value total_position accumu_return  
date                                                                
2019-01-07      -302.1         315.34          13.24         13.24  
2019-04-16        52.9              0           52.9          52.9  
2019-04-23     -322.55         381.89          59.34         59.34  
2019-05-13       29.74              0          29.74         29.74  
2019-06-20     -336.17         365.21          29.04         29.04  
2019-07-19      -12.77              0         -12.77        -12.77  
2019-10-16     -295.89         286.28          -9.61         -9.61  
2019-10-22     -24.731              0        -24.731       -24.731  
2019-10-31    -315.731         287.41        -28.321       -28.321  
2020-03-10      40.694              0         40.694        40.694  
2020-03-27    -318.396         357.12         38.724        38.724  
2020-05-29      99.064              0         99.064        99.064  
2020-06-02    -326.806         427.31        100.504       100.504  
2020-06-05      80.484              0         80.484        80.484  
2020-06-10    -355.516         434.48         78.964        78.964  
Accumulated profit/loss for one share of stock with initial capital of $0 at the end of modeling period: $130.12
The current status of the model is: Holding a position since 2020-06-10 00:00:00 

Processing portfolio for model: EMA_012_SlowMA_30_FastMA_10
BOUGHT QTY: 1 on 2019-01-08 00:00:00 at the price of 319.98
SOLD QTY: -1 on 2019-04-18 00:00:00 at the price of 355.0
BOUGHT QTY: 1 on 2019-04-23 00:00:00 at the price of 375.45
SOLD QTY: -1 on 2019-05-14 00:00:00 at the price of 348.71
BOUGHT QTY: 1 on 2019-06-24 00:00:00 at the price of 370.27
SOLD QTY: -1 on 2019-07-19 00:00:00 at the price of 323.4
BOUGHT QTY: 1 on 2019-11-01 00:00:00 at the price of 288.7
SOLD QTY: -1 on 2020-03-13 00:00:00 at the price of 330.51
BOUGHT QTY: 1 on 2020-03-31 00:00:00 at the price of 367.93
           trade_action qty_onhand cost_basis sold_transaction gain_loss  \
date                                                                       
2019-01-08            1          1     319.98                0         0   
2019-04-18           -1          0          0              355     35.02   
2019-04-23            1          1     375.45                0         0   
2019-05-14           -1          0          0           348.71    -26.74   
2019-06-24            1          1     370.27                0         0   
2019-07-19           -1          0          0            323.4    -46.87   
2019-11-01            1          1      288.7                0         0   
2020-03-13           -1          0          0           330.51     41.81   
2020-03-31            1          1     367.93                0         0   

           cash_onhand position_value total_position accumu_return  
date                                                                
2019-01-08     -319.98         320.27           0.29          0.29  
2019-04-18       35.02              0          35.02         35.02  
2019-04-23     -340.43         381.89          41.46         41.46  
2019-05-14        8.28              0           8.28          8.28  
2019-06-24     -361.99         371.04           9.05          9.05  
2019-07-19      -38.59              0         -38.59        -38.59  
2019-11-01     -327.29         286.81         -40.48        -40.48  
2020-03-13        3.22              0           3.22          3.22  
2020-03-31     -364.71          375.5          10.79         10.79  
Accumulated profit/loss for one share of stock with initial capital of $0 at the end of modeling period: $120.93
The current status of the model is: Holding a position since 2020-03-31 00:00:00 

Processing portfolio for model: EMA_013_SlowMA_30_FastMA_15
BOUGHT QTY: 1 on 2019-01-08 00:00:00 at the price of 319.98
SOLD QTY: -1 on 2019-05-15 00:00:00 at the price of 343.34
BOUGHT QTY: 1 on 2019-06-24 00:00:00 at the price of 370.27
SOLD QTY: -1 on 2019-07-22 00:00:00 at the price of 312.0
BOUGHT QTY: 1 on 2019-11-05 00:00:00 at the price of 289.99
SOLD QTY: -1 on 2020-03-13 00:00:00 at the price of 330.51
BOUGHT QTY: 1 on 2020-04-01 00:00:00 at the price of 376.05
           trade_action qty_onhand cost_basis sold_transaction gain_loss  \
date                                                                       
2019-01-08            1          1     319.98                0         0   
2019-05-15           -1          0          0           343.34     23.36   
2019-06-24            1          1     370.27                0         0   
2019-07-22           -1          0          0              312    -58.27   
2019-11-05            1          1     289.99                0         0   
2020-03-13           -1          0          0           330.51     40.52   
2020-04-01            1          1     376.05                0         0   

           cash_onhand position_value total_position accumu_return  
date                                                                
2019-01-08     -319.98         320.27           0.29          0.29  
2019-05-15       23.36              0          23.36         23.36  
2019-06-24     -346.91         371.04          24.13         24.13  
2019-07-22      -34.91              0         -34.91        -34.91  
2019-11-05      -324.9         288.03         -36.87        -36.87  
2020-03-13        5.61              0           5.61          5.61  
2020-04-01     -370.44         364.08          -6.36         -6.36  
Accumulated profit/loss for one share of stock with initial capital of $0 at the end of modeling period: $115.20
The current status of the model is: Holding a position since 2020-04-01 00:00:00 

Processing portfolio for model: EMA_014_SlowMA_30_FastMA_20
BOUGHT QTY: 1 on 2019-01-09 00:00:00 at the price of 317.71
SOLD QTY: -1 on 2019-05-16 00:00:00 at the price of 356.37
BOUGHT QTY: 1 on 2019-06-25 00:00:00 at the price of 370.75
SOLD QTY: -1 on 2019-07-22 00:00:00 at the price of 312.0
BOUGHT QTY: 1 on 2019-11-07 00:00:00 at the price of 290.7
SOLD QTY: -1 on 2020-03-17 00:00:00 at the price of 306.18
BOUGHT QTY: 1 on 2020-04-02 00:00:00 at the price of 364.08
           trade_action qty_onhand cost_basis sold_transaction gain_loss  \
date                                                                       
2019-01-09            1          1     317.71                0         0   
2019-05-16           -1          0          0           356.37     38.66   
2019-06-25            1          1     370.75                0         0   
2019-07-22           -1          0          0              312    -58.75   
2019-11-07            1          1      290.7                0         0   
2020-03-17           -1          0          0           306.18     15.48   
2020-04-02            1          1     364.08                0         0   

           cash_onhand position_value total_position accumu_return  
date                                                                
2019-01-09     -317.71         319.96           2.25          2.25  
2019-05-16       38.66              0          38.66         38.66  
2019-06-25     -332.09          360.3          28.21         28.21  
2019-07-22      -20.09              0         -20.09        -20.09  
2019-11-07     -310.79         289.57         -21.22        -21.22  
2020-03-17       -4.61              0          -4.61         -4.61  
2020-04-02     -368.69         370.08           1.39          1.39  
Accumulated profit/loss for one share of stock with initial capital of $0 at the end of modeling period: $116.95
The current status of the model is: Holding a position since 2020-04-02 00:00:00 

Processing portfolio for model: EMA_015_SlowMA_35_FastMA_05
BOUGHT QTY: 1 on 2019-01-07 00:00:00 at the price of 302.1
SOLD QTY: -1 on 2019-04-16 00:00:00 at the price of 355.0
BOUGHT QTY: 1 on 2019-04-23 00:00:00 at the price of 375.45
SOLD QTY: -1 on 2019-05-13 00:00:00 at the price of 352.29
BOUGHT QTY: 1 on 2019-06-21 00:00:00 at the price of 365.0
SOLD QTY: -1 on 2019-07-19 00:00:00 at the price of 323.4
BOUGHT QTY: 1 on 2019-10-18 00:00:00 at the price of 289.36
SOLD QTY: -1 on 2019-10-21 00:00:00 at the price of 272.89
BOUGHT QTY: 1 on 2019-10-31 00:00:00 at the price of 291.0
SOLD QTY: -1 on 2020-03-12 00:00:00 at the price of 326.5
BOUGHT QTY: 1 on 2020-03-27 00:00:00 at the price of 359.09
SOLD QTY: -1 on 2020-06-08 00:00:00 at the price of 416.0
BOUGHT QTY: 1 on 2020-06-10 00:00:00 at the price of 436.0
           trade_action qty_onhand cost_basis sold_transaction gain_loss  \
date                                                                       
2019-01-07            1          1      302.1                0         0   
2019-04-16           -1          0          0              355      52.9   
2019-04-23            1          1     375.45                0         0   
2019-05-13           -1          0          0           352.29    -23.16   
2019-06-21            1          1        365                0         0   
2019-07-19           -1          0          0            323.4     -41.6   
2019-10-18            1          1     289.36                0         0   
2019-10-21           -1          0          0           272.89    -16.47   
2019-10-31            1          1        291                0         0   
2020-03-12           -1          0          0            326.5      35.5   
2020-03-27            1          1     359.09                0         0   
2020-06-08           -1          0          0              416     56.91   
2020-06-10            1          1        436                0         0   

           cash_onhand position_value total_position accumu_return  
date                                                                
2019-01-07      -302.1         315.34          13.24         13.24  
2019-04-16        52.9              0           52.9          52.9  
2019-04-23     -322.55         381.89          59.34         59.34  
2019-05-13       29.74              0          29.74         29.74  
2019-06-21     -335.26         369.21          33.95         33.95  
2019-07-19      -11.86              0         -11.86        -11.86  
2019-10-18     -301.22          275.3         -25.92        -25.92  
2019-10-21      -28.33              0         -28.33        -28.33  
2019-10-31     -319.33         287.41         -31.92        -31.92  
2020-03-12        7.17              0           7.17          7.17  
2020-03-27     -351.92         357.12            5.2           5.2  
2020-06-08       64.08              0          64.08         64.08  
2020-06-10     -371.92         434.48          62.56         62.56  
Accumulated profit/loss for one share of stock with initial capital of $0 at the end of modeling period: $113.72
The current status of the model is: Holding a position since 2020-06-10 00:00:00 

Processing portfolio for model: EMA_016_SlowMA_35_FastMA_10
BOUGHT QTY: 1 on 2019-01-08 00:00:00 at the price of 319.98
SOLD QTY: -1 on 2019-05-14 00:00:00 at the price of 348.71
BOUGHT QTY: 1 on 2019-06-24 00:00:00 at the price of 370.27
SOLD QTY: -1 on 2019-07-19 00:00:00 at the price of 323.4
BOUGHT QTY: 1 on 2019-11-04 00:00:00 at the price of 288.0
SOLD QTY: -1 on 2020-03-13 00:00:00 at the price of 330.51
BOUGHT QTY: 1 on 2020-03-31 00:00:00 at the price of 367.93
           trade_action qty_onhand cost_basis sold_transaction gain_loss  \
date                                                                       
2019-01-08            1          1     319.98                0         0   
2019-05-14           -1          0          0           348.71     28.73   
2019-06-24            1          1     370.27                0         0   
2019-07-19           -1          0          0            323.4    -46.87   
2019-11-04            1          1        288                0         0   
2020-03-13           -1          0          0           330.51     42.51   
2020-03-31            1          1     367.93                0         0   

           cash_onhand position_value total_position accumu_return  
date                                                                
2019-01-08     -319.98         320.27           0.29          0.29  
2019-05-14       28.73              0          28.73         28.73  
2019-06-24     -341.54         371.04           29.5          29.5  
2019-07-19      -18.14              0         -18.14        -18.14  
2019-11-04     -306.14         292.86         -13.28        -13.28  
2020-03-13       24.37              0          24.37         24.37  
2020-03-31     -343.56          375.5          31.94         31.94  
Accumulated profit/loss for one share of stock with initial capital of $0 at the end of modeling period: $142.08
The current status of the model is: Holding a position since 2020-03-31 00:00:00 

Processing portfolio for model: EMA_017_SlowMA_35_FastMA_15
BOUGHT QTY: 1 on 2019-01-09 00:00:00 at the price of 317.71
SOLD QTY: -1 on 2019-05-15 00:00:00 at the price of 343.34
BOUGHT QTY: 1 on 2019-06-25 00:00:00 at the price of 370.75
SOLD QTY: -1 on 2019-07-22 00:00:00 at the price of 312.0
BOUGHT QTY: 1 on 2019-11-06 00:00:00 at the price of 288.19
SOLD QTY: -1 on 2020-03-16 00:00:00 at the price of 306.63
BOUGHT QTY: 1 on 2020-04-01 00:00:00 at the price of 376.05
           trade_action qty_onhand cost_basis sold_transaction gain_loss  \
date                                                                       
2019-01-09            1          1     317.71                0         0   
2019-05-15           -1          0          0           343.34     25.63   
2019-06-25            1          1     370.75                0         0   
2019-07-22           -1          0          0              312    -58.75   
2019-11-06            1          1     288.19                0         0   
2020-03-16           -1          0          0           306.63     18.44   
2020-04-01            1          1     376.05                0         0   

           cash_onhand position_value total_position accumu_return  
date                                                                
2019-01-09     -317.71         319.96           2.25          2.25  
2019-05-15       25.63              0          25.63         25.63  
2019-06-25     -345.12          360.3          15.18         15.18  
2019-07-22      -33.12              0         -33.12        -33.12  
2019-11-06     -321.31         288.59         -32.72        -32.72  
2020-03-16      -14.68              0         -14.68        -14.68  
2020-04-01     -390.73         364.08         -26.65        -26.65  
Accumulated profit/loss for one share of stock with initial capital of $0 at the end of modeling period: $94.91
The current status of the model is: Holding a position since 2020-04-01 00:00:00 

Processing portfolio for model: EMA_018_SlowMA_35_FastMA_20
BOUGHT QTY: 1 on 2019-01-09 00:00:00 at the price of 317.71
SOLD QTY: -1 on 2019-05-20 00:00:00 at the price of 351.23
BOUGHT QTY: 1 on 2019-06-25 00:00:00 at the price of 370.75
SOLD QTY: -1 on 2019-07-22 00:00:00 at the price of 312.0
BOUGHT QTY: 1 on 2019-11-11 00:00:00 at the price of 289.16
SOLD QTY: -1 on 2020-03-17 00:00:00 at the price of 306.18
BOUGHT QTY: 1 on 2020-04-01 00:00:00 at the price of 376.05
           trade_action qty_onhand cost_basis sold_transaction gain_loss  \
date                                                                       
2019-01-09            1          1     317.71                0         0   
2019-05-20           -1          0          0           351.23     33.52   
2019-06-25            1          1     370.75                0         0   
2019-07-22           -1          0          0              312    -58.75   
2019-11-11            1          1     289.16                0         0   
2020-03-17           -1          0          0           306.18     17.02   
2020-04-01            1          1     376.05                0         0   

           cash_onhand position_value total_position accumu_return  
date                                                                
2019-01-09     -317.71         319.96           2.25          2.25  
2019-05-20       33.52              0          33.52         33.52  
2019-06-25     -337.23          360.3          23.07         23.07  
2019-07-22      -25.23              0         -25.23        -25.23  
2019-11-11     -314.39         294.18         -20.21        -20.21  
2020-03-17       -8.21              0          -8.21         -8.21  
2020-04-01     -384.26         364.08         -20.18        -20.18  
Accumulated profit/loss for one share of stock with initial capital of $0 at the end of modeling period: $101.38
The current status of the model is: Holding a position since 2020-04-01 00:00:00 

Processing portfolio for model: EMA_019_SlowMA_40_FastMA_05
BOUGHT QTY: 1 on 2019-01-07 00:00:00 at the price of 302.1
SOLD QTY: -1 on 2019-04-16 00:00:00 at the price of 355.0
BOUGHT QTY: 1 on 2019-04-17 00:00:00 at the price of 365.05
SOLD QTY: -1 on 2019-04-18 00:00:00 at the price of 355.0
BOUGHT QTY: 1 on 2019-04-22 00:00:00 at the price of 359.7
SOLD QTY: -1 on 2019-05-14 00:00:00 at the price of 348.71
BOUGHT QTY: 1 on 2019-06-21 00:00:00 at the price of 365.0
SOLD QTY: -1 on 2019-07-19 00:00:00 at the price of 323.4
BOUGHT QTY: 1 on 2019-10-18 00:00:00 at the price of 289.36
SOLD QTY: -1 on 2019-10-21 00:00:00 at the price of 272.89
BOUGHT QTY: 1 on 2019-11-01 00:00:00 at the price of 288.7
SOLD QTY: -1 on 2020-03-12 00:00:00 at the price of 326.5
BOUGHT QTY: 1 on 2020-03-27 00:00:00 at the price of 359.09
           trade_action qty_onhand cost_basis sold_transaction gain_loss  \
date                                                                       
2019-01-07            1          1      302.1                0         0   
2019-04-16           -1          0          0              355      52.9   
2019-04-17            1          1     365.05                0         0   
2019-04-18           -1          0          0              355    -10.05   
2019-04-22            1          1      359.7                0         0   
2019-05-14           -1          0          0           348.71    -10.99   
2019-06-21            1          1        365                0         0   
2019-07-19           -1          0          0            323.4     -41.6   
2019-10-18            1          1     289.36                0         0   
2019-10-21           -1          0          0           272.89    -16.47   
2019-11-01            1          1      288.7                0         0   
2020-03-12           -1          0          0            326.5      37.8   
2020-03-27            1          1     359.09                0         0   

           cash_onhand position_value total_position accumu_return  
date                                                                
2019-01-07      -302.1         315.34          13.24         13.24  
2019-04-16        52.9              0           52.9          52.9  
2019-04-17     -312.15         354.74          42.59         42.59  
2019-04-18       42.85              0          42.85         42.85  
2019-04-22     -316.85         377.34          60.49         60.49  
2019-05-14       31.86              0          31.86         31.86  
2019-06-21     -333.14         369.21          36.07         36.07  
2019-07-19       -9.74              0          -9.74         -9.74  
2019-10-18      -299.1          275.3          -23.8         -23.8  
2019-10-21      -26.21              0         -26.21        -26.21  
2019-11-01     -314.91         286.81          -28.1         -28.1  
2020-03-12       11.59              0          11.59         11.59  
2020-03-27      -347.5         357.12           9.62          9.62  
Accumulated profit/loss for one share of stock with initial capital of $0 at the end of modeling period: $138.14
The current status of the model is: Holding a position since 2020-03-27 00:00:00 

Processing portfolio for model: EMA_020_SlowMA_40_FastMA_10
BOUGHT QTY: 1 on 2019-01-08 00:00:00 at the price of 319.98
SOLD QTY: -1 on 2019-05-15 00:00:00 at the price of 343.34
BOUGHT QTY: 1 on 2019-06-24 00:00:00 at the price of 370.27
SOLD QTY: -1 on 2019-07-19 00:00:00 at the price of 323.4
BOUGHT QTY: 1 on 2019-11-05 00:00:00 at the price of 289.99
SOLD QTY: -1 on 2020-03-13 00:00:00 at the price of 330.51
BOUGHT QTY: 1 on 2020-03-31 00:00:00 at the price of 367.93
           trade_action qty_onhand cost_basis sold_transaction gain_loss  \
date                                                                       
2019-01-08            1          1     319.98                0         0   
2019-05-15           -1          0          0           343.34     23.36   
2019-06-24            1          1     370.27                0         0   
2019-07-19           -1          0          0            323.4    -46.87   
2019-11-05            1          1     289.99                0         0   
2020-03-13           -1          0          0           330.51     40.52   
2020-03-31            1          1     367.93                0         0   

           cash_onhand position_value total_position accumu_return  
date                                                                
2019-01-08     -319.98         320.27           0.29          0.29  
2019-05-15       23.36              0          23.36         23.36  
2019-06-24     -346.91         371.04          24.13         24.13  
2019-07-19      -23.51              0         -23.51        -23.51  
2019-11-05      -313.5         288.03         -25.47        -25.47  
2020-03-13       17.01              0          17.01         17.01  
2020-03-31     -350.92          375.5          24.58         24.58  
Accumulated profit/loss for one share of stock with initial capital of $0 at the end of modeling period: $134.72
The current status of the model is: Holding a position since 2020-03-31 00:00:00 

Processing portfolio for model: EMA_021_SlowMA_40_FastMA_15
BOUGHT QTY: 1 on 2019-01-09 00:00:00 at the price of 317.71
SOLD QTY: -1 on 2019-05-16 00:00:00 at the price of 356.37
BOUGHT QTY: 1 on 2019-06-25 00:00:00 at the price of 370.75
SOLD QTY: -1 on 2019-07-22 00:00:00 at the price of 312.0
BOUGHT QTY: 1 on 2019-11-08 00:00:00 at the price of 288.73
SOLD QTY: -1 on 2020-03-17 00:00:00 at the price of 306.18
BOUGHT QTY: 1 on 2020-04-01 00:00:00 at the price of 376.05
           trade_action qty_onhand cost_basis sold_transaction gain_loss  \
date                                                                       
2019-01-09            1          1     317.71                0         0   
2019-05-16           -1          0          0           356.37     38.66   
2019-06-25            1          1     370.75                0         0   
2019-07-22           -1          0          0              312    -58.75   
2019-11-08            1          1     288.73                0         0   
2020-03-17           -1          0          0           306.18     17.45   
2020-04-01            1          1     376.05                0         0   

           cash_onhand position_value total_position accumu_return  
date                                                                
2019-01-09     -317.71         319.96           2.25          2.25  
2019-05-16       38.66              0          38.66         38.66  
2019-06-25     -332.09          360.3          28.21         28.21  
2019-07-22      -20.09              0         -20.09        -20.09  
2019-11-08     -308.82         291.57         -17.25        -17.25  
2020-03-17       -2.64              0          -2.64         -2.64  
2020-04-01     -378.69         364.08         -14.61        -14.61  
Accumulated profit/loss for one share of stock with initial capital of $0 at the end of modeling period: $106.95
The current status of the model is: Holding a position since 2020-04-01 00:00:00 

Processing portfolio for model: EMA_022_SlowMA_40_FastMA_20
BOUGHT QTY: 1 on 2019-01-10 00:00:00 at the price of 314.57
SOLD QTY: -1 on 2019-05-21 00:00:00 at the price of 350.95
BOUGHT QTY: 1 on 2019-06-25 00:00:00 at the price of 370.75
SOLD QTY: -1 on 2019-07-22 00:00:00 at the price of 312.0
BOUGHT QTY: 1 on 2019-11-13 00:00:00 at the price of 291.03
SOLD QTY: -1 on 2020-03-17 00:00:00 at the price of 306.18
BOUGHT QTY: 1 on 2020-04-01 00:00:00 at the price of 376.05
           trade_action qty_onhand cost_basis sold_transaction gain_loss  \
date                                                                       
2019-01-10            1          1     314.57                0         0   
2019-05-21           -1          0          0           350.95     36.38   
2019-06-25            1          1     370.75                0         0   
2019-07-22           -1          0          0              312    -58.75   
2019-11-13            1          1     291.03                0         0   
2020-03-17           -1          0          0           306.18     15.15   
2020-04-01            1          1     376.05                0         0   

           cash_onhand position_value total_position accumu_return  
date                                                                
2019-01-10     -314.57         324.66          10.09         10.09  
2019-05-21       36.38              0          36.38         36.38  
2019-06-25     -334.37          360.3          25.93         25.93  
2019-07-22      -22.37              0         -22.37        -22.37  
2019-11-13      -313.4         283.11         -30.29        -30.29  
2020-03-17       -7.22              0          -7.22         -7.22  
2020-04-01     -383.27         364.08         -19.19        -19.19  
Accumulated profit/loss for one share of stock with initial capital of $0 at the end of modeling period: $102.37
The current status of the model is: Holding a position since 2020-04-01 00:00:00 

Processing portfolio for model: EMA_023_SlowMA_45_FastMA_05
BOUGHT QTY: 1 on 2019-01-07 00:00:00 at the price of 302.1
SOLD QTY: -1 on 2019-05-14 00:00:00 at the price of 348.71
BOUGHT QTY: 1 on 2019-06-21 00:00:00 at the price of 365.0
SOLD QTY: -1 on 2019-07-19 00:00:00 at the price of 323.4
BOUGHT QTY: 1 on 2019-11-04 00:00:00 at the price of 288.0
SOLD QTY: -1 on 2020-03-13 00:00:00 at the price of 330.51
BOUGHT QTY: 1 on 2020-03-27 00:00:00 at the price of 359.09
           trade_action qty_onhand cost_basis sold_transaction gain_loss  \
date                                                                       
2019-01-07            1          1      302.1                0         0   
2019-05-14           -1          0          0           348.71     46.61   
2019-06-21            1          1        365                0         0   
2019-07-19           -1          0          0            323.4     -41.6   
2019-11-04            1          1        288                0         0   
2020-03-13           -1          0          0           330.51     42.51   
2020-03-27            1          1     359.09                0         0   

           cash_onhand position_value total_position accumu_return  
date                                                                
2019-01-07      -302.1         315.34          13.24         13.24  
2019-05-14       46.61              0          46.61         46.61  
2019-06-21     -318.39         369.21          50.82         50.82  
2019-07-19        5.01              0           5.01          5.01  
2019-11-04     -282.99         292.86           9.87          9.87  
2020-03-13       47.52              0          47.52         47.52  
2020-03-27     -311.57         357.12          45.55         45.55  
Accumulated profit/loss for one share of stock with initial capital of $0 at the end of modeling period: $174.07
The current status of the model is: Holding a position since 2020-03-27 00:00:00 

Processing portfolio for model: EMA_024_SlowMA_45_FastMA_10
BOUGHT QTY: 1 on 2019-01-08 00:00:00 at the price of 319.98
SOLD QTY: -1 on 2019-05-15 00:00:00 at the price of 343.34
BOUGHT QTY: 1 on 2019-06-24 00:00:00 at the price of 370.27
SOLD QTY: -1 on 2019-07-19 00:00:00 at the price of 323.4
BOUGHT QTY: 1 on 2019-11-07 00:00:00 at the price of 290.7
SOLD QTY: -1 on 2020-03-13 00:00:00 at the price of 330.51
BOUGHT QTY: 1 on 2020-03-31 00:00:00 at the price of 367.93
           trade_action qty_onhand cost_basis sold_transaction gain_loss  \
date                                                                       
2019-01-08            1          1     319.98                0         0   
2019-05-15           -1          0          0           343.34     23.36   
2019-06-24            1          1     370.27                0         0   
2019-07-19           -1          0          0            323.4    -46.87   
2019-11-07            1          1      290.7                0         0   
2020-03-13           -1          0          0           330.51     39.81   
2020-03-31            1          1     367.93                0         0   

           cash_onhand position_value total_position accumu_return  
date                                                                
2019-01-08     -319.98         320.27           0.29          0.29  
2019-05-15       23.36              0          23.36         23.36  
2019-06-24     -346.91         371.04          24.13         24.13  
2019-07-19      -23.51              0         -23.51        -23.51  
2019-11-07     -314.21         289.57         -24.64        -24.64  
2020-03-13        16.3              0           16.3          16.3  
2020-03-31     -351.63          375.5          23.87         23.87  
Accumulated profit/loss for one share of stock with initial capital of $0 at the end of modeling period: $134.01
The current status of the model is: Holding a position since 2020-03-31 00:00:00 

Processing portfolio for model: EMA_025_SlowMA_45_FastMA_15
BOUGHT QTY: 1 on 2019-01-09 00:00:00 at the price of 317.71
SOLD QTY: -1 on 2019-05-20 00:00:00 at the price of 351.23
BOUGHT QTY: 1 on 2019-06-25 00:00:00 at the price of 370.75
SOLD QTY: -1 on 2019-07-22 00:00:00 at the price of 312.0
BOUGHT QTY: 1 on 2019-11-12 00:00:00 at the price of 295.32
SOLD QTY: -1 on 2020-03-17 00:00:00 at the price of 306.18
BOUGHT QTY: 1 on 2020-03-31 00:00:00 at the price of 367.93
           trade_action qty_onhand cost_basis sold_transaction gain_loss  \
date                                                                       
2019-01-09            1          1     317.71                0         0   
2019-05-20           -1          0          0           351.23     33.52   
2019-06-25            1          1     370.75                0         0   
2019-07-22           -1          0          0              312    -58.75   
2019-11-12            1          1     295.32                0         0   
2020-03-17           -1          0          0           306.18     10.86   
2020-03-31            1          1     367.93                0         0   

           cash_onhand position_value total_position accumu_return  
date                                                                
2019-01-09     -317.71         319.96           2.25          2.25  
2019-05-20       33.52              0          33.52         33.52  
2019-06-25     -337.23          360.3          23.07         23.07  
2019-07-22      -25.23              0         -25.23        -25.23  
2019-11-12     -320.55         292.01         -28.54        -28.54  
2020-03-17      -14.37              0         -14.37        -14.37  
2020-03-31      -382.3          375.5           -6.8          -6.8  
Accumulated profit/loss for one share of stock with initial capital of $0 at the end of modeling period: $103.34
The current status of the model is: Holding a position since 2020-03-31 00:00:00 

Processing portfolio for model: EMA_026_SlowMA_45_FastMA_20
BOUGHT QTY: 1 on 2019-01-10 00:00:00 at the price of 314.57
SOLD QTY: -1 on 2019-05-22 00:00:00 at the price of 358.01
BOUGHT QTY: 1 on 2019-06-25 00:00:00 at the price of 370.75
SOLD QTY: -1 on 2019-07-22 00:00:00 at the price of 312.0
BOUGHT QTY: 1 on 2019-11-19 00:00:00 at the price of 304.01
SOLD QTY: -1 on 2020-03-18 00:00:00 at the price of 302.395
BOUGHT QTY: 1 on 2020-03-31 00:00:00 at the price of 367.93
           trade_action qty_onhand cost_basis sold_transaction gain_loss  \
date                                                                       
2019-01-10            1          1     314.57                0         0   
2019-05-22           -1          0          0           358.01     43.44   
2019-06-25            1          1     370.75                0         0   
2019-07-22           -1          0          0              312    -58.75   
2019-11-19            1          1     304.01                0         0   
2020-03-18           -1          0          0          302.395    -1.615   
2020-03-31            1          1     367.93                0         0   

           cash_onhand position_value total_position accumu_return  
date                                                                
2019-01-10     -314.57         324.66          10.09         10.09  
2019-05-22       43.44              0          43.44         43.44  
2019-06-25     -327.31          360.3          32.99         32.99  
2019-07-22      -15.31              0         -15.31        -15.31  
2019-11-19     -319.32          302.6         -16.72        -16.72  
2020-03-18     -16.925              0        -16.925       -16.925  
2020-03-31    -384.855          375.5         -9.355        -9.355  
Accumulated profit/loss for one share of stock with initial capital of $0 at the end of modeling period: $100.78
The current status of the model is: Holding a position since 2020-03-31 00:00:00 

Processing portfolio for model: EMA_027_SlowMA_50_FastMA_05
BOUGHT QTY: 1 on 2019-01-07 00:00:00 at the price of 302.1
SOLD QTY: -1 on 2019-05-14 00:00:00 at the price of 348.71
BOUGHT QTY: 1 on 2019-06-21 00:00:00 at the price of 365.0
SOLD QTY: -1 on 2019-07-19 00:00:00 at the price of 323.4
BOUGHT QTY: 1 on 2019-11-05 00:00:00 at the price of 289.99
SOLD QTY: -1 on 2020-03-13 00:00:00 at the price of 330.51
BOUGHT QTY: 1 on 2020-03-27 00:00:00 at the price of 359.09
           trade_action qty_onhand cost_basis sold_transaction gain_loss  \
date                                                                       
2019-01-07            1          1      302.1                0         0   
2019-05-14           -1          0          0           348.71     46.61   
2019-06-21            1          1        365                0         0   
2019-07-19           -1          0          0            323.4     -41.6   
2019-11-05            1          1     289.99                0         0   
2020-03-13           -1          0          0           330.51     40.52   
2020-03-27            1          1     359.09                0         0   

           cash_onhand position_value total_position accumu_return  
date                                                                
2019-01-07      -302.1         315.34          13.24         13.24  
2019-05-14       46.61              0          46.61         46.61  
2019-06-21     -318.39         369.21          50.82         50.82  
2019-07-19        5.01              0           5.01          5.01  
2019-11-05     -284.98         288.03           3.05          3.05  
2020-03-13       45.53              0          45.53         45.53  
2020-03-27     -313.56         357.12          43.56         43.56  
Accumulated profit/loss for one share of stock with initial capital of $0 at the end of modeling period: $172.08
The current status of the model is: Holding a position since 2020-03-27 00:00:00 

Processing portfolio for model: EMA_028_SlowMA_50_FastMA_10
BOUGHT QTY: 1 on 2019-01-08 00:00:00 at the price of 319.98
SOLD QTY: -1 on 2019-05-16 00:00:00 at the price of 356.37
BOUGHT QTY: 1 on 2019-06-24 00:00:00 at the price of 370.27
SOLD QTY: -1 on 2019-07-19 00:00:00 at the price of 323.4
BOUGHT QTY: 1 on 2019-11-11 00:00:00 at the price of 289.16
SOLD QTY: -1 on 2020-03-16 00:00:00 at the price of 306.63
BOUGHT QTY: 1 on 2020-03-31 00:00:00 at the price of 367.93
           trade_action qty_onhand cost_basis sold_transaction gain_loss  \
date                                                                       
2019-01-08            1          1     319.98                0         0   
2019-05-16           -1          0          0           356.37     36.39   
2019-06-24            1          1     370.27                0         0   
2019-07-19           -1          0          0            323.4    -46.87   
2019-11-11            1          1     289.16                0         0   
2020-03-16           -1          0          0           306.63     17.47   
2020-03-31            1          1     367.93                0         0   

           cash_onhand position_value total_position accumu_return  
date                                                                
2019-01-08     -319.98         320.27           0.29          0.29  
2019-05-16       36.39              0          36.39         36.39  
2019-06-24     -333.88         371.04          37.16         37.16  
2019-07-19      -10.48              0         -10.48        -10.48  
2019-11-11     -299.64         294.18          -5.46         -5.46  
2020-03-16        6.99              0           6.99          6.99  
2020-03-31     -360.94          375.5          14.56         14.56  
Accumulated profit/loss for one share of stock with initial capital of $0 at the end of modeling period: $124.70
The current status of the model is: Holding a position since 2020-03-31 00:00:00 

Processing portfolio for model: EMA_029_SlowMA_50_FastMA_15
BOUGHT QTY: 1 on 2019-01-09 00:00:00 at the price of 317.71
SOLD QTY: -1 on 2019-05-21 00:00:00 at the price of 350.95
BOUGHT QTY: 1 on 2019-06-25 00:00:00 at the price of 370.75
SOLD QTY: -1 on 2019-07-22 00:00:00 at the price of 312.0
BOUGHT QTY: 1 on 2019-11-18 00:00:00 at the price of 296.0
SOLD QTY: -1 on 2020-03-17 00:00:00 at the price of 306.18
BOUGHT QTY: 1 on 2020-03-31 00:00:00 at the price of 367.93
           trade_action qty_onhand cost_basis sold_transaction gain_loss  \
date                                                                       
2019-01-09            1          1     317.71                0         0   
2019-05-21           -1          0          0           350.95     33.24   
2019-06-25            1          1     370.75                0         0   
2019-07-22           -1          0          0              312    -58.75   
2019-11-18            1          1        296                0         0   
2020-03-17           -1          0          0           306.18     10.18   
2020-03-31            1          1     367.93                0         0   

           cash_onhand position_value total_position accumu_return  
date                                                                
2019-01-09     -317.71         319.96           2.25          2.25  
2019-05-21       33.24              0          33.24         33.24  
2019-06-25     -337.51          360.3          22.79         22.79  
2019-07-22      -25.51              0         -25.51        -25.51  
2019-11-18     -321.51         302.57         -18.94        -18.94  
2020-03-17      -15.33              0         -15.33        -15.33  
2020-03-31     -383.26          375.5          -7.76         -7.76  
Accumulated profit/loss for one share of stock with initial capital of $0 at the end of modeling period: $102.38
The current status of the model is: Holding a position since 2020-03-31 00:00:00 

Processing portfolio for model: EMA_030_SlowMA_50_FastMA_20
BOUGHT QTY: 1 on 2019-01-10 00:00:00 at the price of 314.57
SOLD QTY: -1 on 2019-05-24 00:00:00 at the price of 355.41
BOUGHT QTY: 1 on 2019-06-25 00:00:00 at the price of 370.75
SOLD QTY: -1 on 2019-07-22 00:00:00 at the price of 312.0
BOUGHT QTY: 1 on 2019-11-20 00:00:00 at the price of 301.01
SOLD QTY: -1 on 2020-03-19 00:00:00 at the price of 324.33
BOUGHT QTY: 1 on 2020-03-30 00:00:00 at the price of 363.0
           trade_action qty_onhand cost_basis sold_transaction gain_loss  \
date                                                                       
2019-01-10            1          1     314.57                0         0   
2019-05-24           -1          0          0           355.41     40.84   
2019-06-25            1          1     370.75                0         0   
2019-07-22           -1          0          0              312    -58.75   
2019-11-20            1          1     301.01                0         0   
2020-03-19           -1          0          0           324.33     23.32   
2020-03-30            1          1        363                0         0   

           cash_onhand position_value total_position accumu_return  
date                                                                
2019-01-10     -314.57         324.66          10.09         10.09  
2019-05-24       40.84              0          40.84         40.84  
2019-06-25     -329.91          360.3          30.39         30.39  
2019-07-22      -17.91              0         -17.91        -17.91  
2019-11-20     -318.92         305.16         -13.76        -13.76  
2020-03-19        5.41              0           5.41          5.41  
2020-03-30     -357.59         370.96          13.37         13.37  
Accumulated profit/loss for one share of stock with initial capital of $0 at the end of modeling period: $128.05
The current status of the model is: Holding a position since 2020-03-30 00:00:00 

In [18]:
# Display the model performance summary
performance_summary.sort_values(by=['return_value'], inplace=True, ascending=False)
print(performance_summary)
                     model_name  return_value return_percent
22  EMA_023_SlowMA_45_FastMA_05       174.070           None
26  EMA_027_SlowMA_50_FastMA_05       172.080           None
15  EMA_016_SlowMA_35_FastMA_10       142.080           None
18  EMA_019_SlowMA_40_FastMA_05       138.140           None
19  EMA_020_SlowMA_40_FastMA_10       134.720           None
23  EMA_024_SlowMA_45_FastMA_10       134.010           None
4   EMA_005_SlowMA_20_FastMA_10       130.445           None
10  EMA_011_SlowMA_30_FastMA_05       130.124           None
9   EMA_010_SlowMA_25_FastMA_20       128.960           None
8   EMA_009_SlowMA_25_FastMA_15       128.560           None
29  EMA_030_SlowMA_50_FastMA_20       128.050           None
1   EMA_002_SlowMA_15_FastMA_05       125.590           None
27  EMA_028_SlowMA_50_FastMA_10       124.700           None
11  EMA_012_SlowMA_30_FastMA_10       120.930           None
13  EMA_014_SlowMA_30_FastMA_20       116.950           None
12  EMA_013_SlowMA_30_FastMA_15       115.200           None
14  EMA_015_SlowMA_35_FastMA_05       113.720           None
2   EMA_003_SlowMA_15_FastMA_10       113.455           None
6   EMA_007_SlowMA_25_FastMA_05       107.915           None
20  EMA_021_SlowMA_40_FastMA_15       106.950           None
24  EMA_025_SlowMA_45_FastMA_15       103.340           None
28  EMA_029_SlowMA_50_FastMA_15       102.380           None
21  EMA_022_SlowMA_40_FastMA_20       102.370           None
17  EMA_018_SlowMA_35_FastMA_20       101.380           None
25  EMA_026_SlowMA_45_FastMA_20       100.785           None
3   EMA_004_SlowMA_20_FastMA_05        97.645           None
16  EMA_017_SlowMA_35_FastMA_15        94.910           None
7   EMA_008_SlowMA_25_FastMA_10        73.320           None
5   EMA_006_SlowMA_20_FastMA_15        48.700           None
0   EMA_001_SlowMA_10_FastMA_05        24.685           None
In [19]:
# Display the transactions from the top model
top_model = performance_summary.iloc[0]['model_name']
print('The transactions from the top model %s:' % (top_model))
print(portfolio_collection[top_model][portfolio_collection[top_model].trade_action != 0])
The transactions from the top model EMA_023_SlowMA_45_FastMA_05:
           trade_action qty_onhand cost_basis sold_transaction gain_loss  \
date                                                                       
2019-01-07            1          1      302.1                0         0   
2019-05-14           -1          0          0           348.71     46.61   
2019-06-21            1          1        365                0         0   
2019-07-19           -1          0          0            323.4     -41.6   
2019-11-04            1          1        288                0         0   
2020-03-13           -1          0          0           330.51     42.51   
2020-03-27            1          1     359.09                0         0   

           cash_onhand position_value total_position accumu_return  
date                                                                
2019-01-07      -302.1         315.34          13.24         13.24  
2019-05-14       46.61              0          46.61         46.61  
2019-06-21     -318.39         369.21          50.82         50.82  
2019-07-19        5.01              0           5.01          5.01  
2019-11-04     -282.99         292.86           9.87          9.87  
2020-03-13       47.52              0          47.52         47.52  
2020-03-27     -311.57         357.12          45.55         45.55  
In [20]:
# Display the entry and exit signals for the top model
print('The trading signal changes from the top model %s:' % (top_model))
print(model_collection[top_model][model_collection[top_model].signal_change != 0])
The trading signal changes from the top model EMA_023_SlowMA_45_FastMA_05:
            open_price  close_price     fast_ma     slow_ma  ma_change  \
date                                                                     
2019-01-04      281.88       297.57  275.730669  274.027704   1.702965   
2019-05-13      352.29       345.26  359.311786  363.147351  -3.835566   
2019-06-20      365.91       365.21  358.288204  355.793544   2.494660   
2019-07-18      323.76       325.21  353.858302  363.121323  -9.263021   
2019-11-01      288.70       286.81  285.152431  284.890309   0.262122   
2020-03-12      326.50       315.25  344.725788  355.997124 -11.271336   
2020-03-26      344.00       362.99  350.341988  349.453249   0.888740   

            trade_signal  signal_change  entry_exit  
date                                                 
2019-01-04           1.0            1.0         0.0  
2019-05-13           0.0           -1.0         0.0  
2019-06-20           1.0            1.0         0.0  
2019-07-18           0.0           -1.0         0.0  
2019-11-01           1.0            1.0         0.0  
2020-03-12           0.0           -1.0         0.0  
2020-03-26           1.0            1.0         0.0  
In [21]:
graph_data = model_collection[top_model].copy()
title_string = "Exponential Moving Average Crossover Model for " + top_model
fig = plt.figure(figsize=(16,9))
ylabel = stock_symbol + ' price in $'
ax1 = fig.add_subplot(111, ylabel=ylabel, title=title_string)
graph_data['fast_ma'].plot(ax=ax1, color='b', lw=2.)
graph_data['slow_ma'].plot(ax=ax1, color='r', lw=2.)
graph_data['close_price'].plot(ax=ax1, color='g')
ax1.plot(graph_data.loc[graph_data.entry_exit == 1].index, graph_data.close_price[graph_data.entry_exit == 1], '^', markersize=7, color='k',label='buy')
ax1.plot(graph_data.loc[graph_data.entry_exit == -1].index, graph_data.close_price[graph_data.entry_exit == -1], 'v', markersize=7, color='k',label='sell')
plt.legend(loc='upper left')
plt.show()

Task 5. Evaluate Performance

In [22]:
best_model = ''
best_return = 0
for key in portfolio_collection:
    if portfolio_collection[key]['accumu_return'][-1] > best_return:
        best_model = key
        best_return = portfolio_collection[best_model]['accumu_return'][-1]
print('The best model found is:', best_model)
print('The best profit/loss for the investing period is: $%.2f' % (best_return))
if initial_capital != 0:
    print('The best return percentage for initial capital is: %.2f%%' % (best_return / initial_capital * 100))
The best model found is: EMA_023_SlowMA_45_FastMA_05
The best profit/loss for the investing period is: $174.07
In [23]:
worst_model = None
worst_return = 0
for key in portfolio_collection:
    if portfolio_collection[key]['accumu_return'][-1] < worst_return:
        worst_model = key
        worst_return = portfolio_collection[worst_model]['accumu_return'][-1]
print('The worst model found is:', worst_model)
print('The worst profit/loss for the investing period is: $%.2f' % (worst_return))
if initial_capital != 0:
    print('The worst return percentage for the initial capital is: %.2f%%' % (worst_return / initial_capital * 100))
The worst model found is: None
The worst profit/loss for the investing period is: $0.00
In [24]:
# Calculate the stock's performance for a long-only model
model_template = model_template[model_start_date:model_end_date]
print('The performance of the long-only model from day one is: $%.2f' %(model_template.iloc[-1]['close_price'] - model_template.iloc[0]['open_price']))
The performance of the long-only model from day one is: $226.36
In [25]:
print ('Total time for the script:',(datetime.now() - startTimeScript))
Total time for the script: 0:01:41.030552